Re: Moving to AMD64 bit and porting issues

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

 



Using NULL in this case is not portable; you *must*
use a cast to the exact pointer type that the
varargs function expects to see.  Different pointer
types can have different representation.

However, it does seem that must platforms understand NULL and assigns
the correct type.  I do agree that for portability we should use the
cast.

Sure; with GCC, all targets (that I know of) use the same
representation (and ABI) for pointers to any data object.
This is not true for pointers to function, though.  So in
practice the code [with plain NULL instead of (type *)0]
will work fine; it is still not correct C code, though.

I thought we had a warning for this nowadays, btw?


Segher


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux