long long availability in host compiler (Re: constant that doesn't fit in 32bits in alpha.c)

Mike Stump mikestump@comcast.net
Fri Jun 15 21:46:00 GMT 2012


On Jun 15, 2012, at 1:11 PM, Eric Botcazou wrote:
> Why would HOST_WIDE_INT be obsolete?

For the same reason that we don't use HOST_NARROW_INT instead of int.  In practice, int is portable enough for us now.  In reality, long long is portable for us now.  20 years ago, it wasn't portable enough.  Times change.  What's changed?  We'll we now have a language standard for long long, other implementors have had a chance to implement that standard, systems have had a chance to update and provide implementations of that standard and systems that don't support have died from hardware failure or have been scraped because they consume too much electricity to be useful anymore.

This situation is more like prototypes than patch reviews.  See patch reviews are useful for catching code bugs, HOST_WIDE_INT is not as useful as catching code bugs.  Prototypes used to be new fangled things that very few compiler had.  One could not portably use them.  Guess what, times change, compilers implement them, language standards adopt them, and system vendors provide implementations that support them.  The systems that never supported them go away, the people that know of a world in which compilers that don't support prototypes die.

We allow portability hacks into the source base for important system (implementations) were we don't want to just nix a platform wholesale.  See things like:

          /* This was a conditional expression but it triggered a bug                                     
             in Sun C 5.5.  */

in the source base.  We do this, not for some theoretic beauty but for very practical and pragmatic reasons.  In time, even the above can be safely removed.  We have already removed support for prototypes (not being supported), and yet, we still have patch reviews.

So, to be practical, let us list the systems, platforms and implementations we are thinking of nixing, if we require long long to support at least 64-bit math.  Let me start:, ok, I'm done, now it is your turn.  I'm fine for avoiding long long, if there is a system people want to support that needs it, I am merely ignorant of such a system.

> That's a nice way to abstract the host

Yes, but why abstract the host?  HOST_NARROW_INT is a nice way to abstract the host as well, that is a necessary but not sufficient reason.  We do it to support an actual, real system, platform or implementation that fails to provide long long.  When there are no longer any such systems, then the time is right to switch to the standard.  Now, why do we do this, because we prefer standards to aide in readability and portability.  A person new to gcc, but knows C or C++ knows what long long is.  HOST_WIDE_INT, well, they have to take a mental hit on and figure it out, if they care.



More information about the Gcc-patches mailing list