|
|
|
|
|
by JeremyStein
6066 days ago
|
|
!ptr is bad. I worked with a C programmer who changed all occurrences of "ptr != 0" to "!ptr". The program stopped working. In Windows, a null pointer is not 0. The C idiom "ptr != 0" compiles correctly, but when you try to get clever with "!ptr", you were in trouble. The expression would evaluate to false on a null pointer. (At least with the version of Visual C++ we were using back then.) |
|
http://www.research.att.com/~bs/bs_faq2.html#null
http://www.faqs.org/faqs/C-faq/faq/