
18 Nov
2009
18 Nov
'09
6:57 a.m.
On Tue, Nov 17, 2009 at 7:35 PM, Mateusz Loskot <mateusz@loskot.net> wrote:
Emil Dotchevski wrote:
On Tue, Nov 17, 2009 at 2:57 PM, Mateusz Loskot <mateusz@loskot.net> wrote:
Nothing wrong for me personally, but I've heard some say it's too long and unnecessary as in assert(0 != ptr) all 5 characters can be replaced with just one !
Assuming ptr is a pointer, AFAIK assert(ptr) is illegal, though assert(ptr!=0) and assert(!ptr) are OK.
Yes, that's right. In this case some suggest to use assert(!!ptr) what I do not really consider personally as readable, prefering assert(0 != ptr);
Can someone explain how assert(ptr) is illegal? I haven't heard that before. Is if (ptr) illegal now too? Tony