This is the mail archive of the gcc@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: C constant expressions proposals


On Tue, 17 Aug 2004, Geoffrey Keating wrote:

> The point of 20010327-1.c is that it's the only way to get certain
> functionality out of the linker.  It's necessary for strange cases
> involving, for instance, an interface between 32-bit and 64-bit code.
> It's perfectly OK if this is only accepted in an initializer, but it
> does need to be accepted.

So what (in terms of target macros if necessary) is the specification of 
exactly what cases are meant to be accepted?  I gave the examples

static unsigned long x = (unsigned long) ((uintptr_t)&_text + 123) + 456;
static long y = (long) ((intptr_t)((uintptr_t)&_text + 123)) + 456;

which are both of the given form (extend an address constant to a wider 
type, then add a constant), but are they valid?  What about converting to 
a narrower type?

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


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