This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Warning for unadorned 0 in varargs lists?
On Mon, Aug 23, 2004 at 06:25:51PM +0200, Andreas Schwab wrote:
> >>> I used to feel as you do, that since 0 works in practice we should
> >> In practice it does _not_ work.
> > On which system, specifically?
> ia64, for example. Probably also amd64.
Every system with sizeof(void*) != sizeof(int). This is almost every 64 bit
system which defines int to be 32 bit but a pointer 64 bit.
However, afair ANSI C says that sizeof(void*) == sizeof(long), so it should
be save to use 0L for null pointers (unless the abi defines something like
extending all pointers to 128 bit values in function calls or something
alike - I think some mainframe systems made that with the upper 64 reserved
for the type of the pointer - but I'm not sure if this is ok with ANSI C).
by the end, that pointers can be compared with 0 to check for null
pointers doesn't imply that it would be save to use 0 as a pointer without
explictely casting it to one.
yours,
- clifford
--
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Prof: So the American government went to IBM to come up with *
* a data encryption standard and they came up with ... *
* Student: EBCDIC! *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
checking whether the linker (ld -static) supports shared libraries... yes