Re: Patch for definition of NULL



On Wednesday, July 11, 2001, at 10:17  PM, Kaz Kylheku wrote:

I have no idea why Solaris switches between 0 and 0L; probably someone
clueless is maintaining the header. A zero-valued integral constant expression
is a null pointer constant. It doesn't matter if it's long, unsigned
or whatever. If they have a good reason, correct me.

When a NULL is used as part of a variable argument list, it can be important that its size match the size of a pointer, not an integer. In theory, the only legal way to do this is to pass (void *) NULL or (char *) NULL or something like that, but defining NULL as 0L will make NULL work in variable argument lists in more cases. When there's no variable argument list involved, I think you're right that there's no good reason to use 0L.

I don't know if that's a "good" reason, but it is a reason.

    -- Darin




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