I'm not sure if my understanding of C++ is wrong.. I've read that 1) all non-zero values are equivalent to TRUE, and zero is equivalent to FALSE; 2) null pointers are stored as zero.
Yet code like this:
void ViewCell::swapTiles (ViewCell *vc) {
ViewTile *tmp = vc->tile();
[stuff ...]
if (tmp) addTile(tmp);
}
Gives me a segfault from dereferencing a null pointer, but
if (tmp != 0) addTile(tmp);
works fine. Any idea why?