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]

Re: Preprocessor arithmetic


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

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