This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Moving to AMD64 bit and porting issues


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]