It seems the coding guidelines have been getting a lot of attention
lately, especially from the GSoC attendees such as myself.
It would probabily be a good ideea to update them, and I think people
should have a say in what the final version looks like. I believe this
thread could be used to make proposals and I will start with my own:
1. Clearly state what C++ standard is supported. Taking decisions based
on out-of-date compilers shouldn't be acceptable. We live in a world
where C++11 is gaining wide adoption and rules that forbid the use of
basic features (e.g. ternary operator or automatic arrays
initializers) should no longer be accepted. If a certain compiler fails
to correctly implement the C++ standard, it is the compiler's fault.
C++ code should be written with regards to the standard and its
implementation in the few major compilers that are used today.
2. Discourage the use of the preprocessor. Currently, the preprocessor
is used for everything from defining platform-dependent values to
accessing data members, implementing functions and defining constants.
As anyone familiar with the C++ literature would know the preprocessor
is highly discouraged. (e.g. Effective C++ Item 2).
3. Templates should continue to be disallowed. They are the least
understood part of the C++ language by developers and wxWidgets already
has features to compensate for them.
4. Encourage the use of small functions. Functions are not only usefull
for preventing repetition, they are also usefull for giving a name to a
block of code. Functions that are implemented in terms of other functions
are much easier to read because they are self documented.
5. Discourage the abuse of comments. Good code is self documented.
Comments are thus required only when the implementation is too ugly to
be understood. We should strive to avoid such implementations. Also
separators such as:
// -------------------------------------------------------------------
// event types and macros
// -------------------------------------------------------------------
only add clutter and distract the reader from the actual code.
6. Consider adopting a standard way of documenting public interfaces.
Being mentioned in Bjarne Stroustrup's new book is surely a worthy
achievement, but I believe it's crucial to also keep up with the new C++
language also mentioned in his book.
Please take the time to comment and contribute to these proposals.