Moving to AMD64 bit and porting issues
Ernest L. Williams Jr.
ernesto@ornl.gov
Fri Nov 4 12:05:00 GMT 2005
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
>
More information about the Gcc-help
mailing list