Why do some c++ compilers let you take the address of a literal?

后端 未结 5 462
北荒
北荒 2021-01-03 08:08

A C++ compiler that I will not name lets you take the address of a literal, int *p = &42;

Clearly 42 is an r-value and most compilers refuse to do so.

W

5条回答
  •  迷失自我
    2021-01-03 08:53

    Found something related to rvalue references in C++0x -- move semantics http://www.artima.com/cppsource/rvalue.html

提交回复
热议问题