Re: using literal zero for NULL
- From: mortenw gnome org (Morten Welinder)
- To: gtk-devel-list gnome org
- Subject: Re: using literal zero for NULL
- Date: Tue, 21 Mar 2006 14:46:44 -0500 (EST)
> 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
defined
#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.
M.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]