7
votes
Vote UpVote

One-liner RAII in Delphi

Entropy Overload – Some C++ aficionados point at the ability, in C++, to create an object such that the creation allocates some kind of resource, and the destruction frees the resource, with much glee. The idiom is RAII: Resource Acquisition Is Initialization. The technique can be a useful, albeit somewhat opaque, way of acquiring a resource for the duration of a block of code and relinquishing the resource upon exiting the block. It's C++'s equivalent of Delphi / Java / C# / SEH's try / finally blocks (though of course C#'s "using" statement is an even closer analogue). Delphi has a similar mechanism in the ...
Favorite? Off-Topic? Barry Kelly @ 2010-01-29 22:52

Statistics

Visits: 758
Votes: 7
Favorites: 1
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

_Serg_
LachlanG
Paweł Głowacki
Primoz Gabrijelcic
stukelly
Tier777
vcldeveloper
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)