This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Moving to AMD64 bit and porting issues
- From: "Ernest L. Williams Jr." <ernesto at ornl dot gov>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: Ian Lance Taylor <ian at airs dot com>, "Alex J. Dam" <alexjdam at gmail dot com>,GCC-Help <gcc-help at gcc dot gnu dot org>
- Date: Fri, 04 Nov 2005 07:05:30 -0500
- Subject: Re: Moving to AMD64 bit and porting issues
- References: <1129958772.5288.22.camel@lion> <20051024102542.GA3154@hymen><1130150271.24804.69.camel@localhost.localdomain><m3wtk23fiq.fsf@gossamer.airs.com><61a69f794d1144ba9db3959d2f043afb@kernel.crashing.org>
- Reply-to: ernesto at ornl dot gov
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
>