Jonathan Wakely wrote, On 26/09/11 09:53:
On 26 September 2011 09:32, Jon Grant wrote:
[.]
bool invalid = (NULL == p);

Why is that preferable?

It would be clearer IMHO what was happening.

I expect this depends on what the standard allows then.


4.12 Boolean conversions [conv.bool]
1  A prvalue of arithmetic, unscoped enumeration, pointer, or pointer
to member type can be converted to a
prvalue of type bool. A zero value, null pointer value, or null member
pointer value is converted to false;
any other value is converted to true. A prvalue of type std::nullptr_t
can be converted to a prvalue of
type bool; the resulting value is false.

I stand corrected. No reason to change anything if it is in the standard. Thank you for discussing this point.

Best regards, Jon

Reply via email to