Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > return address ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 8 Topic 43764 of 47926
Post > Topic >>

return address of tem****ary variable?

by thomas <FreshThomas@[EMAIL PROTECTED] > Mar 9, 2008 at 07:14 AM

-----code----
vector<int> &calc(){
    vector<int> temp;
    temp.push_back(3);

    return temp;
}
----code----

"temp" is a tem****ary variable, when returned, it's like return by
alias.
So is the code above legal?
 




 8 Posts in Topic:
return address of temporary variable?
thomas <FreshThomas@[E  2008-03-09 07:14:25 
Re: return address of temporary variable?
"Alf P. Steinbach&qu  2008-03-09 15:29:22 
Re: return address of temporary variable?
Abdullah <plcoderREMOV  2008-03-09 07:29:24 
Re: return address of temporary variable?
thomas <FreshThomas@[E  2008-03-09 07:36:01 
Re: return address of temporary variable?
=?UTF-8?B?RXJpayBXaWtzdHL  2008-03-09 14:55:22 
Re: return address of temporary variable?
Juha Nieminen <nospam@  2008-03-09 16:37:31 
Re: return address of temporary variable?
John Dibling <jdibling  2008-03-09 12:15:18 
Re: return address of temporary variable?
ytrembla@[EMAIL PROTECTED  2008-03-10 14:34:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Oct 6 18:01:55 CDT 2008.