I’m sure I’ve blogged about this before. I just don’t know where.
It drives me nuts. In what other languages, other than C and C++, is it acceptable to totally ignore the style that the standard uses? In Java, the “standard” is the Java API written by Sun. Everyone, and I mean everyone who writes Java uses that style or they are a laughingstock.
The same goes for lisp. The same goes for PHP. The list could go on and on.
But C++? Well, what the hey! Microsoft writes its code a certain way, so that must be an acceptable style, no? Arrrgggghh. The style used by K&R, Stroustrup, and the standards committee is nothing like what Microsoft (and consequently, thousands of programmers) use on a regular basis, and it drives me batty.
In C, names should be brief and descriptive, generally one word or multiple, abbrieviated words. Everything should be lower cased, except for preprocessor macros, which should generally be capitalized.
In C++, names should generally be more descriptive, and words should be separated by an underscore character (i.e., ‘special_vector’ or ‘address_table’). This includes classes, which people sometimes use the Microsoft style, which is *wrong*. Of course, style is arbitrary and not actually defined in the standard – but convention in most languages is generally to do things like the standard library does it, and Microsoft does not do it like the standard library does it. The same rules apply to preprocessor macros.
If I never see a class with camel-case styling again it’ll be too soon.