- 论坛徽章:
- 0
|
本帖最后由 wwwsq 于 2012-05-28 23:00 编辑
pmerofc 发表于 2012-05-28 22:45
(a=b)的值等于a
和
(a=b)就是a
左值右值只是编译层面的概念,(a=b)>0在执行层面,就是把b赋值给a,然后用a的值去做比较。
http://msdn.microsoft.com/en-us/library/b0zx90af.aspx
The assignment operators return the value of the object specified by the left operand after the assignment. The resultant type is the type of the left operand. The result of an assignment expression is always an l-value. These operators have right-to-left associativity. The left operand must be a modifiable l-value.
NoteNote
In ANSI C, the result of an assignment expression is not an l-value. Therefore, the legal C++ expression (a += b) += c is illegal in C.
你看,在c++里面,左值右值就不是那么回事了。这只是编译器的处理。
如果你觉得微软的资料还不够权威,请给出你的资料来源。
|
|