BartC said:
That's like saying we don't need a multiply op in the language, because the
adds and shifts that are otherwise needed, get converted into a hardware
multiply by a super-clever compiler.
Perhaps.
It is much easier to add a few extra ops into a language and not use them
very often, than to leave them out and have to rely on tricks by programmers
and compiler writers.
[Context: bit rotation operators]
Really? You might have a valid argument in favor of adding rotation
operators to the language at the beginning. But at this point,
I think it would require a tremendous effort with little payoff.
We'd have to define symbols for the new operators and define their
precedence (and survive the inevitable flame wars, because plenty
of people are going to think the new syntax is ugly and/or "not
in the spirit of C"). If the new symbols are new keywords such
as "rol" and "ror", then we break existing code that uses those
identifiers (possibly the very code that would benefit from the
operators). Then the new operators would have to be included in a
new C standard. If we're *extremely* optimistic, we might imagine
them being standardized in C201X.
And then programmers will have to wait for C201X, or at least this
feature, to be supported by all the compilers their code might be
used with before they can safely use them.
I suppose they could start now by writing pre-C201X and C201X
versions of the code, controlled by #if or #ifdef. But then
they'll have to maintain both versions for a very long time --
and one version or the other might get very little testing.
Changing a compiler to implement the new operators (even for systems
that don't support the operations in hardware) is the easy part.
If you think I'm being overly pessimistic, please convince me.