This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: "gcc" complains about a constant being non constant...


"Linda A. Walsh" <gcc@tlinx.org> writes:

> The fact that C++ "fixes" this isn't really a difference in the language, it's just a 'next-generation' of the compile time constant folding.  In "C" you'd
> have to do the same thing using "#define"'s which just looked uglier...

I think it is clearly a difference in the language, in that the
respective language standards spell out how things should be handled.


> Can you think of any backward incompatibility if "C were to rold compile
> time constants the same way C++ did?

The C language standard was carefully written to not require the
compiler to implement target arithmetic.  This is particularly an issue
for floating point operations, but it also arises for, e.g., signed
magnitude machines, which were a consideration at the time the C
standard was first written.

The C standard specifies that the preprocessor is explicitly permitted
to use host arithmetic, but such permission would not be appropriate for
constants which are not handled by the preprocessor.

Ian


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