These are things that i would change if i were to modify a C++ compiler to implement my own variation of the C++ language.
- In functions with several parameters having default values, it should be possible to specify a value for, say, the last one without having to also specify values for all the previous parameters. In other words, one should be able to leave out one of the values in an actual-parameter list—two commas with nothing in between.
- Also, in an actual parameter list (in the declaration or definition of the function) it should be possible to specify default values for one of the parameters without having to specify default values for every parameter thereafter.
- “switch” statemens need quite a bit of redesigning. definately shouldn’t be a simple syntactic rewrite like it is now.
- get rid of fall-through and get rid of “break”. instead, allow multiple values for a single case. e.g.:
case 'a','A',23,5:
whatever();
case 'b','B',99:
whatever();
- In the global scope, the order of function definitions shouldn’t matter. Methods within a class can call other methods that are declared below them; why shouldn’t the global namespace be like that too?
- Initialize all member data right where it is declared. Both static and non-static. Initial values would then be implicitly added to the initializer lists of all constructors.
- Consider a function that (A) has default value specified for one or more of its parameters, and (B) is declared in one place and then defined in another. Both versions of the formal parameter list should be allowed to have the default value specified, as long as the values are exactly the same in both places (otherwise generate an error).
- Within the body of a class—rather than writing “public:”, “protected:”, or “private:” to indicate the access-type of everything that follows—each member function or variable should be labelled with “public”, “protected”, or “private”. Those that are not labelled will go to a default value.
- For cleaner syntax, declare all variables in the form: ”(type) (modifiers) (name)”
- “int const X” instead of “const int X”
- “int const& X” instead of “const int & X”
- “int const* X” instead of “const int * X”
- Modifiers like “static”, “public”, “protected”, “private” should come before the type.