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++ > Re: tem****ary ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 4 Topic 45800 of 47017
Post > Topic >>

Re: tem****ary object in function call

by "Jim Langston" <tazmaster@[EMAIL PROTECTED] > May 7, 2008 at 07:27 PM

red floyd wrote:
> thucdat@[EMAIL PROTECTED]
 wrote:
>> Visual Studio C++ compiles the following:
>>
>>
>>
>> class someclass {
>>         //
>> };
>>
>> void somefunction(someclass &) {
>>        //
>> }
>>
>> int main() {
>>        somefunction(someclass());
>>        return 0;
>> }
>>
>>
>>
>> But Dev-C++ (Bloodshed) and g++ don't. I wonder if Visual Studio C++
>> is smarter here.
>
> No, Bloodshed (which uses g++) and g++ are correct.  You can't bind a
> tem****ary to a non-const ref.  If you turn of MS extensions (I think
> it's /Za) VStudio will also properly generate an error.

Also setting warning levels to 4 in VStudio will produce a warning.

-- 
Jim Langston
tazmaster@[EMAIL PROTECTED]

 




 4 Posts in Topic:
temporary object in function call
thucdat@[EMAIL PROTECTED]  2008-05-07 14:08:01 
Re: temporary object in function call
"Alf P. Steinbach&qu  2008-05-07 23:13:57 
Re: temporary object in function call
red floyd <no.spam@[EM  2008-05-07 16:35:47 
Re: temporary object in function call
"Jim Langston"   2008-05-07 19:27:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Thu Jul 24 15:55:05 CDT 2008.