gnu-arch-users
[Top][All Lists]
Advanced

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

[Gnu-arch-users] Re: posible issue on ia64 with va_args.


From: Jan Hudec
Subject: [Gnu-arch-users] Re: posible issue on ia64 with va_args.
Date: Fri, 12 Mar 2004 10:03:04 +0100
User-agent: Mutt/1.5.5.1+cvs20040105i

On Fri, Mar 12, 2004 at 10:47:45 +0900, Miles Bader wrote:
> Jan Hudec <address@hidden> writes:
> > IIRC it's only specified, that any type shorter than integer will be
> > promoted to size of integer. And NO relation between sizeof(int),
> > sizeof(long) and sizeof(void *) is claimed by specification whatsoever!
> > 
> > It is known to hold on all widely used platforms that sizeof(int) <=
> > sizeof(void *) <= sizeof(long), but no stricter relation holds.
> 
> Even when that relation holds, this particular case can screw you; for
> it to `work', you need sizeof (int) == sizeof (whatever_ptr).

Even than, the spec does not guarantee you are safe.

The spec does not say anything about relation of pointer to integer. It
implies, that (void *)0 == NULL and (int)NULL == 0, but does not say the
memory representation is the same. So you must cast a parameter to be
read as pointer to pointer -- either explicitely (use NULL) or
implicitely (via prototype).

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec 
<address@hidden>

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]