Re: using literal zero for NULL

> There's no way for the compiler to know that the sentinel is
> supposed to be a pointer.  It's simply implemented as a varargs
> function.  Maybe we should emphasize the importance of using NULL
> in our documentation.

This is where it would be a bit evil to mention that NULL might be

#define NULL 0

and that using NULL therefore doesn't really help.  (I.e., NULL
is a null pointer, but does not have pointer type.  Yeehaa!)

So -- according to the standard -- what you must do is to call
with the right type:

    foo (arg1, arg2, ..., (char *)0);

In practice, for any system that glib will ever work on, however,
NULL is just fine.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]