Keith Thompson<kst- said:
In message<
[email protected]>, Francois Grieu
On 28/12/2010 23:16, Keith Thompson wrote:
There are also some preliminary drafts of the
upcoming C201X standard available. I think the latest is
[n1516] though I could have missed a more recent one.
Latest seems to be n1547, made 2010-12-02, posted 2010-12-03
<
http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1547.pdf>
I wonder what are the C99 features made non-mandatory in C201x,
as hinted by "Major changes from the previous edition include:
— conditional (optional) features (including some that were
previously mandatory)"
For several years I have been saying that some C99 features would be
dropped in the next standard and no one believed me. It all stemmed
from the discussions at the end of the WG14 meeting in April 2007.
I see some features being made optional. I don't see anything
being dropped.
Semantics. If features no one is implementing are being made optional
they are effectively dropped.
True. For instance, if I have to write portable code working with
complex numbers, I cannot afford to assume that complex support will
ever be universally available. That's not a change, of course; fully
conforming C99 compilers are still quite rare, and with this decision, I
doubt that many more will bother adding complex support in the future;
in fact, I expect that many will drop whatever support they currently
provide.
With C1x, I could, in principle, do a feature-test #if to determine if
complex numbers are supported, and if so, write simple, easily
understood code using them directly. However, in the #else clause, I'll
have to write substantially more complicated code that does the same
thing without relying upon complex support, storing the real and complex
components as separate members of the same array, or as separate members
of a struct.
Since I'll have to write the complicated code anyway, why bother writing
the simpler code? Making sure that the more complicated code is correct
is going to be difficult enough; why add in the need to make sure that
the simple code and the complicated code say the same thing? Therefore,
as far as portable code is concerned, making it optional is pretty much
the same as dropping it entirely. Using some other language with
guaranteed support for complex numbers, such as C++ or Fortran, would be
the more appropriate way to go, I think.
All this means is that the C committee has decided to restrict the
domain of usefulness of C, in the interests of making is cleaner, easier
to understand language and standard library. That might be a very
reasonable decision for the language as a whole, no matter how
inconvenient it may be for those who rely upon complex support. However,
the full benefits of that decision won't be gained until complex support
is actually dropped, and not merely optional, because until that's done,
it won't actually be a simpler language and standard library.