Friday, August 14, 2009

C/C++ Tips

For C:

1) All object and function identifiers shall be declared before use.

2) All automatic variables shall have been assigned a value before being used.

3) Functions shall always be declared at file scope. Functions shall always have prototype declarations and the prototype shall be visible at both the function definition and call.

4) C macros shall only be used of symbolic constants, function-like macros, type qualifiers and storage class specifiers.

For C++:

1) Always write access control specifiers; removes all ambiguity; list the public methods first, with special member functions at the top

2) Lower case letters for local varibales,data members,functions.Upper case letters for names of types, namespaces,global variables.

3) Template functions define a famly of functions for different template arguments.

To be continue....

No comments: