S
Shen Weihui
Is it valid that testing `this` against 0 in a non-static member
function? Since I found that this kind of construction was totally
eliminated by the compiler in the release build.
In N3126 (9.3.2/1), it says, 'In the body of a non-static (9.3) member
function, the keyword this is a prvalue expression whose value is the
address of the object for which the function is called.'
So I guess that the compiler assumes that the address of the object
cannot be 0, so it's safe to optimize away the if expression.
function? Since I found that this kind of construction was totally
eliminated by the compiler in the release build.
In N3126 (9.3.2/1), it says, 'In the body of a non-static (9.3) member
function, the keyword this is a prvalue expression whose value is the
address of the object for which the function is called.'
So I guess that the compiler assumes that the address of the object
cannot be 0, so it's safe to optimize away the if expression.