Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Delphi-News aus aller Welt (https://www.delphipraxis.net/58-delphi-news-aus-aller-welt/)
-   -   Try-Finally Blocks for Protecting Multiple Resources in Delphi (https://www.delphipraxis.net/195023-try-finally-blocks-protecting-multiple-resources-delphi.html)

DP News-Robot 26. Jan 2018 18:10

Try-Finally Blocks for Protecting Multiple Resources in Delphi
 
The Delphi language shares with many others a standard resource allocation pattern to make sure that in case of an exception the resources is properly released. Resources in this context are memory objects, files, operating system objects and handles, and the like. In Delphi, compared to other languages with a garbage collector, the relevance increased by memory management considerations.

Protecting a Single Object

In the most simple cases, you'd write code like:

allocate

Weiterlesen...


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:00 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz