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


On Fri, 2005-11-04 at 12:28 +0100, Segher Boessenkool wrote:
> > You can reliably use 0 as a null pointer constant with one exception.
> > When calling a varargs function which expects a pointer as an unnamed
> > argument, and when pointers are 64-bits but int is 32-bits, then you
> > must either use NULL or you must cast 0 to a pointer type.
> 
> 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.



Ernest



> 
> 
> Segher
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]