Re: What is the advantage of "NULL == pMyPointer" instead of "pMyPointer == NULL"?
From: Pete Becker (petebecker_at_acm.org)
Date: 04/09/04
- Next message: Dave: "Interesting vector<> error in 6.0"
- Previous message: Rob Vermeulen: "What is the advantage of "NULL == pMyPointer" instead of "pMyPointer == NULL"?"
- In reply to: Rob Vermeulen: "What is the advantage of "NULL == pMyPointer" instead of "pMyPointer == NULL"?"
- Next in thread: Rob Vermeulen: "Re: What is the advantage of "NULL == pMyPointer" instead of "pMyPointer == NULL"?"
- Reply: Rob Vermeulen: "Re: What is the advantage of "NULL == pMyPointer" instead of "pMyPointer == NULL"?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 09 Apr 2004 10:27:07 -0400
Rob Vermeulen wrote:
>
> In several SDK examples of MS I notice the following.
> To compare a pointer with NULL they do: "NULL == pMyPointer"
> Why not just the other way around, like every "C++ for dummies" book
> describes? :-)
>
Some people worry that they might leave out the second '=' sign and that
their testing isn't adequate to find such a mistake. Writing the test
backwards turns this mistake into an error.
-- Pete Becker Dinkumware, Ltd. (http://www.dinkumware.com)
- Next message: Dave: "Interesting vector<> error in 6.0"
- Previous message: Rob Vermeulen: "What is the advantage of "NULL == pMyPointer" instead of "pMyPointer == NULL"?"
- In reply to: Rob Vermeulen: "What is the advantage of "NULL == pMyPointer" instead of "pMyPointer == NULL"?"
- Next in thread: Rob Vermeulen: "Re: What is the advantage of "NULL == pMyPointer" instead of "pMyPointer == NULL"?"
- Reply: Rob Vermeulen: "Re: What is the advantage of "NULL == pMyPointer" instead of "pMyPointer == NULL"?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|