Automatic variable: Difference between revisions

Content deleted Content added
m Reverting possible vandalism by 117.194.197.114 to version by Jakew. False positive? Report it. Thanks, ClueBot NG. (1087827) (Bot)
Line 5:
 
==In specific programming languages==
=== [[C (programming language)|C]], [[C++]] ===
(Called ''automatic'' variables.)
 
Line 12:
Using the storage class <code>register</code> instead of <code>auto</code> is a hint to the compiler to cache the variable in a processor register. Other than not allowing the referencing operator (<code>&</code>) to be used on the variable or any of its subcomponents, the compiler is free to ignore the hint.
 
In C++, the constructor of automatic variables is called when the execution reaches the place of declaration. The destructor is called when it reaches the end of the given program block (program blocks are surrounded by curly brackets). This feature is often used to manage resource allocation and deallocation, like opening and then automatically closing files or freeing up memory. See [[RAII]].
 
===[[Java (programming language)|Java]]===