Tabs are 4 spaces (no true tabs) Lines in files limited to 100 characters Limit white space (no more than one blank line between lines of code) One statement per line Identifiers should start with lower case letters with each subsequent word capitalized myMethodName Class member variables begin with a_ a_myPrivateVariable Class methods and functions will begin with a lower case letter. Comments should use // notation // firstComment (notice space after //) Calls to functions or methods that go over 100 characters should place each parameter on a subsequent line 1 tab in foo = callMe( firstParameter, secondParameter, thirdParameter, fourthParameter, fifthParameter, sixthParameter); Method or function names should not contain underscore characters #define should be in all caps #define SECONDS_IN_DAY enums should be in following format ... enum StatusChecks { scFirst, scSecond } Punctuation marks should be followed by a space for (long i = 0; i < 10; i++) Code after an if statement should always be on the next line (even for just one line of code) if (y == 0) x++; Class Declarations: Only 1 public, protected and private keyword per class. Methods should be in following order Constructors Destructor Access methods Support methods Operators Virtuals Virtuals from base class Message handlers Macros Statics Access methods should be inlined in the header where appropriate Class Definitions Class names to begin with cis (for example cisSomeClass) Constructor parameters should be 2 tabs in, with the initializer list 1 tab in. All methods other than constructors should have their parameters 1 tab in. class cisSomeClass { public: cisSomeClass(long a); cisSomeClass( thisIsAnExceptionallyLongParameter a, thisIsAnotherExceptionallyLongParameter b, thisIsYetAnotherExceptionallyLongParamer c); ~cisSomeClass(); // access methods // support methods // operators // virtuals // virtuals from base class // message handlers // static methods protected: private: }
Last Modified: Thursday, 27th September, 2012 @ 01:09pm