This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Standards compliant preprocessor arithmetic
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".
In practice, C89 compilers (including GCC until integrated CPP)
appear to have used the target long precision. We have an
outstanding PR that, in C89 mode, CPP uses 64-bit arithmetic
whereas 32-bit arithmetic "is expected".
In view of this, are you sure you'd like C89 and C99 CPP to do the
same precision arithmetic? Shouldn't we be giving the same answers
in C89 mode that GCC 2.x used to give?
I don't have a C89 copy on me, so thanks for quoting the wording.
> > Previously, doing things like using "65536" in CPP arithmetic would
> > not give any diagnostics about an overly large number when target
> > arithmetic is 16-bit; they now happen properly
>
> This is a bad example, since the minimum size for cpp arithmetic is 32
> bits in c89 and 64 bits in c99.
We do have targets, e.g. avr, that have LONG_TYPE_SIZE == 16.
> Because two 32 bit values can't represent a 128-bit value for the
> target's "long long", among other reasons.
Yeah, what a nightmare.
Neil.