rvalue to lvalue conversion Visual Studio

后端 未结 3 597
面向向阳花
面向向阳花 2020-11-27 23:22

In Visual Studio 2012RC there are some non-standard extensions. For example this code compiles:

#include 

using namespace std;

void value(str         


        
3条回答
  •  醉话见心
    2020-11-27 23:52

    Basically, VS will allocate the space somewhere and just let the reference point to it, as if it was a reference-to-const without the constness (or in C++11 an rvalue reference).

    You can disable this behaviour with the /Za (disable language extensions) compiler switch under

    Properties -> C/C++ -> Language

    If I remember correctly.

提交回复
热议问题