tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: definition of NULL correct?
> We define NULL as "(void *)0" rather than "((void *)0)", and that causes
> sizeof NULL
> to fail.
I asked fairly good C language lawyer I'm acquainted with (Peter
Seebach) about this. He says that "there's nothing saying "sizeof
NULL" has to work". Of course, this is probably talking about C, not
the POSIX "some of the gnulib people" are talking about - I've fired
off a follow-up question specifically about POSIX.
His reading of C matches gcc's, that sizeof (void *) 0 is indeed sizeof
a type with a stray (and erroneous) 0 after it - but that's not the
real question here; the real question is whether POSIX contains any
language requiring "sizeof NULL" to be non-erroneous.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse%rodents-montreal.org@localhost
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Home |
Main Index |
Thread Index |
Old Index