I encountered the following code in a file (looks like header file) iomanip of gcc 4.5.1:
inline _Setbase
setbase(int __base)
{ return { __base }; }
what is the language definition of returning a scope (block)?
When a function has a return statement in other blocks, the compiler adds a new variable and returns that value before returning from that function.
A return statement ends the execution of a function, and returns control to the calling function. Execution resumes in the calling function at the point immediately following the call. A return statement can return a value to the calling function.
Nothing physical happens. A typical implementation will allocate enough space in the program stack to store all variables at the deepest level of block nesting in the current function. This space is typically allocated in the stack in one shot at the function startup and released back at the function exit.
Looks like the new syntax for Uniform initialization in C++0x to me.
This isn't returning a block. This constructs an object of type _Setbase
, defined in the same header file as
struct _Setbase { int _M_base; };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With