summary of C-standards workshop at Usenix

BLARSON at USC-ECLB.ARPA BLARSON at USC-ECLB.ARPA
Tue Jul 10 10:47:48 AEST 1984


From:  Bob Larson <BLARSON at USC-ECLB.ARPA>


One possible syntax for a float constant (as opposed to a double constant)
is like this:
    foo = foo + (float) 1.0;

This would work on current compilers as well as ones that did all
float arithmetic in single precision.  The only disadvantages are
reduced accuracy on some machines without saving time, and even more
wasted time for compilers that do casts of constants at runtime.

The other possibility is using the declared (typed) constant like:

const float one = 1.0;
...
    foo = foo + one;

but this has less compatibility with current compilers.

Another suggestion is to have a symbol predefined (perhaps ANSI) if
it is an ansi c compiler for conditional compilation.

Bob Larson<Blarson at Usc-Eclb.arpa>
-------



More information about the Comp.lang.c mailing list