C++0x - why so restrictive with new keywords ?
Hi,
the C++ committee is very restrictive in introducing new keywords in the
C++ standard. An example is the proposal for overriding virtual
functions. (Sad story is I don't know yet if it will be really in the
final draft).
It shall have the syntax:
virtual void foo() >= 0;
virtual void foo() > 0;
Where the natural "human" readable version would be IMHO:
virtual void foo() override abstract;
virtual void foo() override;
Would the introduction of new keywords really break that much "old" code
? I don't think so, if the keywords would be interpreted only in the
context of a function declaration so that old code:
class override {};
class sample : public base
{
virtual void foo() override;
};
would still compile. Only code using
#define override _bad_style_either_
would break.
There are already C++ compilers introducing proprietary new context
sensitive keywords. I had no problem in compiling all my C++ code and
many open source libraries with such compilers.
Is it really worth to sacrifice readability, which also has an impact on
maintainability, for compatibility to some rare cases where macros are
used ? I would prefer readability and rather change my code.
-------------
Additionally it's commonly preferred to implement new functionality in
code, rather than introducing new keywords.
I just would it prefer the other way round, because commonly the
compiler can be more effective and handling is commonly easier by using
a new keyword than a big template library.
E.g.: member function pointers.
It's impressive how much can be done in plain "old" C++98, but
nevertheless I think the compiler could handle member function pointers
more effective than a library. Additionally I wouldn't have to know
which library I have to include and additionally wouldn't have to
increase compilation time due to the inclusion of the library.
Andre
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]