One of the problems with C++ is that it has a very brittle syntax, meaning that it is easy to trip over subtle differences:
1 2 3 4 5 6 7 8 9 |
class D { D(); D( int); } void test() { D a; D b( 1); D c(); } |
In this code, what is c
? Given the definition of b
, it sure looks like a class instantiation, but it actually is a function declaration that returns a class D. This is a problem that could easily be solved by requiring a function declaration without a parameter to use void
, as in:
1 2 3 4 5 6 7 8 9 |
class D { D( void); D( int); } void test() { D a; D b( 1); D c( void); } |
This is more verbose, but it is also more difficult to get wrong. I believe this is what will kill C/C++ in the future: the unwillingness to sacrifice some backward compatibility for a safer syntax, even if one could do a perfect automatic translation.