[SDL] Problem with reusing array of surfaces.

Brian Raiter breadbox at muppetlabs.com
Fri May 9 15:11:02 PDT 2003


[Off-topic for SDL, but a common misconception that I can't let go by]

> I think you can also assume that NULL == 0 on any architecture
> currently in use, so you can just do if(image[0]) ...; to avoid that
> problem entirely.

Actually, the C language requires that a literal zero used as a
pointer shall be understood as a "null pointer constant", regardless
of the actual bit-representation of a null pointer. In other words

    p = 0;

will produce a null pointer even on platforms where

    memset(p, 0, sizeof p);

won't.

Naturally, this also extends to boolean contexts.

b




More information about the SDL mailing list