Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualCornstalks

Posted 04 April 2013 - 08:51 AM

i'm using vs 2010 express,and i can run the code without any problem...

Ah, that's why. VS 2010 has a non-standard extension to allow this. If you bump up your warning level to level 4, you'll see:

 

warning C4239: nonstandard extension used : 'argument' : conversion from 'ra' to 'ra &'

          A non-const reference may only be bound to an lvalue
 
If you go into your project properties, then C/C++, then Language, you can see an option to "Disable Language Extensions" and if you disable them, your code will no longer compile.
 
GCC, VC++, and other compilers often include some "extensions" to the standard language.

#1Cornstalks

Posted 04 April 2013 - 08:41 AM

i'm using vs 2010 express,and i can run the code without any problem...

 

sorry,i wanted to call hey() as an argument,anyway,the code is the correct one now,still,it shouldn't work,but it does...

Ah, that's why. VS 2010 has a non-standard extension to allow this. If you bump up your warning level to level 4, you'll see:

 

 

warning C4239: nonstandard extension used : 'argument' : conversion from 'ra' to 'ra &'
          A non-const reference may only be bound to an lvalue
 
If you go into your project properties, then C/C++, then Language, you can see an option to "Disable Language Extensions" and if you disable them, your code will no longer compile.
 
GCC, VC++, and other compilers often include some "extensions" to the standard language.

PARTNERS