This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Preprocessor arithmetic
- To: Neil Booth <neilb at earthling dot net>
- Subject: Re: Preprocessor arithmetic
- From: "Zack Weinberg" <zackw at Stanford dot EDU>
- Date: Mon, 13 Nov 2000 19:54:29 -0800
- Cc: gcc at gcc dot gnu dot org
- References: <20001113234100.A9631@daikokuya.demon.co.uk>
On Mon, Nov 13, 2000 at 11:41:00PM +0000, Neil Booth wrote:
> Can someone explain to me what is wrong with CPP's arithmetic (as
> referred to on the web page)?
>
> All arithmetic in CPP is done in HOST_WIDEST_INT. My understanding is
> that this is the widest integer that GCC can support on the host;
> which is usually twice the processor's native widest integer (itself
> being HOST_WIDE_INT).
>
> If I don't have it right so far, please correct me.
>
> The standard defines intmax_t and uintmax_t as the "greatest width
> integer types"; capable of representing any value of any (un)signed
> type. Preprocessor arithmetic should be done in these types.
>
> These types seem to be the same thing to me. What am I missing?
Host versus target. [u]intmax_t is the _target_'s largest integer
type. HOST_WIDEST_INT is the host's. They aren't necessarily the
same thing.
It's only an issue when cross-compiling from or to a machine with an
unusual definition of either type - I think all commonly used machines
these days have both be 64bit. But it's still a concern.
zw