IT Community - Software Programming, Web Development and Technical Support

resource acquisition is initialization

This is a discussion on resource acquisition is initialization within the C and C++ Programming forums, part of the Software Development category; Hi Guys Can you explain the term "resource acquisition is initialization?"...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C and C++ Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-28-2007, 06:03 AM
vigneshgets vigneshgets is offline
D-Web Genius
 
Join Date: Mar 2007
Posts: 904
vigneshgets is on a distinguished road
Question resource acquisition is initialization

Hi Guys Can you explain the term "resource acquisition is initialization?"
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-30-2007, 11:33 AM
shanmugamit shanmugamit is offline
D-Web Trainee
 
Join Date: Mar 2007
Posts: 10
shanmugamit is on a distinguished road
Default Re: resource acquisition is initialization

Resource Acquisition Is Initialization, often referred to by the acronym RAII, is a popular programming technique in [[C++]] and D. The technique combines acquisition and release of resources with initialization and uninitialization of variables.

The acquisition is bound to the construction (initialization) whereas the release is bound to the destruction (uninitialization) of the variable. Since a destructor of an automatic variable is called when leaving its scope, it can be guaranteed that the resource is released as soon as the variable's life time ends.

Typical uses
The RAII technique is often used for controlling thread locks in multi-threaded applications. Another typical example of RAII is file operations, e.g. the [[C++ standard library]]'s file-streams. An input file stream is opened in the object's constructor, and it is closed upon destruction of the object. Since C++ allows objects to be allocated on the stack, C++'s scoping mechanism can be used to control file access.

RAII is also used to ensure exception safety. RAII makes it possible to avoid resource leaks without extensive use of try/catch blocks and is widely used in the software industry
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
create resource sivakumar C# Programming 1 07-27-2007 08:37 AM
How to Debug Smartphone Home Plugin Initialization? theone Mobile Software Development 2 07-27-2007 05:48 AM
What about class initialization? prasath Java Programming 1 07-20-2007 06:52 AM
renewable resource nssukumar Promotion Techniques 0 03-20-2007 10:58 PM
Brand New Dmoz Resource Zone Launched sfod223 Search Engine Optimization 0 02-19-2007 10:01 AM


All times are GMT -7. The time now is 07:15 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0