jacob navia said:
I am running in a machine with 32 or 64 bits, and I have to keep
the integer interface as MSVC dictates under windows, and under
linux I have to follow gcc
Since gcc implements long double there is no problem under linux
Under windows there are no floating point arguments to be passed
to the windows API, so I am free to implement things in the best way
possible. Since the machine supports natively long double with a
specific machine type I give access to the user to that as a good
C implementation should do.
Under the power PC architecture I do NOT implement long double since
the machine doesn't support it.
If I didn't know better (and I don't), I'd suspect that you don't know
what "long double" means.
The C standard (both C90 and C99) specifies 3 floating-point types:
float, double, and long double. (The latter can also legally be
referred to as "double long", but I'd consider that poor programming
style.)
It specifies certain minimum requirements for all three types. For
example, FLT_DIG >= 6, DBL_DIG >= 10, LDBL_DIG >= 10. As it happens,
the requirements for long double are exactly the same as the
requirements for double.
An implementation that:
Implements double and meets the standard's requirements for that
type; and
Implements long double as a distinct type with exactly the same
characteristics as double
is a conforming implementation.
For that matter, an implementation for which float happens to meet the
requirements for double can legally use the same characteristics for
*all three* floating-point types.
And on some hardware, it might actually make sense to do so.
Each of C's floating-point types is typically implemented on top of
some specific floating-point format supported by the underlying
hardware (or by software emulation). Note carefully that I'm using
the word "format" rather than "type"; these are not (yet) types in the
C sense.
If a CPU happens to support three different floating-point formats
that meet C's requirements for float, double, and long double (for
example the IEC 60559 single, double, and extended formats), then it
almost certainly makes sense for a C compiler for that CPU to map the
C types float, double, and long double to those formats. And if you
want to criticize the quality of a compiler that fails to do so, as
lcc apparently does, then I won't disagree with you.
*BUT*
Your statement upthread about lcc:
o C89: no long long, nor long double.
was simply misleading. It implies that long double is a new feature
in C99, which it is not. And it implies that lcc doesn't implement
long double, which it most definitely does. It doesn't implement it
in an ideal fashion, and someone considering using lcc should
certainly take that into account.
Obviously for many people here, what matters is not quality but legalese
and they will tell everyone that quality is just unimportant. A compiler
that has no assembler/linker/debugger/Ide etc is prefered to one that
has one since their obscure ideological reasons force them to behave
like jerks. CBFalconer for instance will still complain that
lcc-win doesn't run in a 486. Heathfield will still spit nonsense
when my compiler makes a perfectly C99 compatible extension but
will not complain about other compilers modifying syntax to implement
design by contract. As long as it is NOT lcc-win everything is
accepted.
Bullshit.
You didn't say that the way lcc supports long double is a quality
issue. You implied that it's a conformance issue. If you had
*accurately* described lcc's long double support as a shortcoming but
not a conformance issue, we wouldn't be having this discussion -- or,
if we were, I'd probably be arguing on your side.
I'll just address one of your other points. Name one instance in
which Richard Heathfield has complained about a "perfectly C99
compatible extension" provided by lcc-win.
I predict that you will attempt to do so, that it will turn out either
that Richard wasn't complaining about the extension or that the
extension is not "perfectly C99 compatible", and that you will refuse
to acknowledge this. As always, I hope you prove me wrong.