This is the mail archive of the
mailing list for the GCC project.
Re: Standards compliant preprocessor arithmetic
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Cc: Geoff Keating <geoffk at geoffk dot org>, <gcc-patches at gcc dot gnu dot org>, Zack Weinberg <zack at codesourcery dot com>
- Date: Mon, 27 May 2002 08:24:30 +0100 (BST)
- Subject: Re: Standards compliant preprocessor arithmetic
On Mon, 27 May 2002, Neil Booth wrote:
> Geoff Keating wrote:-
> > The c99 semantics are compliant with the c89 semantics, because of the
> > 'at least'. I'd recommend that we allow the c89 cpp to perform
> > arithmetic to the size of at least the target's "long long".
> I'm going to apply the patch as I originally posted it for this bit.
> I'd like to know what Joseph and Zack think about this; if there's
> agreement I'm happy to change it; it's only the one line (plus the
> testsuite arith-2.c).
Though the standard allows laxity here, I don't think it's a particularly
good idea to use it (to treat target long as longer than it is), any more
than it's a good idea to use laxity about whether character constants in
#if have the same values as they do elsewhere. OTOH long long is
supported as an extension in C89 mode and if long long values are
explicitly used it would be desirable for them to work in #if.
While dealing with the technicalities of standards requirements for
preprocessor arithmetic: if these tests don't cover the case of DR#265, a
test of that case should be added somewhere.
Joseph S. Myers