Tizen 2.1 base
[platform/upstream/libbullet.git] / UnitTests / cppunit / CodingGuideLines.txt
1 CppUnit's coding guidelines for portability:
2 --------------------------------------------
3
4 - don't explicitly declare CppUnit namespace, instead use macro
5   CPPUNIT_NS_BEGIN and CPPUNIT_NS_END.
6
7 - don't explicitly use 'CppUnit' to refer to class in CppUnit namespace,
8   instead use macro CPPUNIT_NS which expands to either 'CppUnit' or 
9   nothing depending on the configuration.
10
11 - don't use the 'using directive', always use full qualification. For STL,
12   always use std::.
13
14 - don't use C++ style cast directly, instead use CppUnit's cast macro
15   (CPPUNIT_CONST_CAST).
16
17 - don't use the mutable keyword, instead do a const cast.
18
19 - don't use the typename keyword in template declaration, instead use 'class'.
20
21 - don't make use of RTTI (typeid) or dynamic_cast mandatory.
22
23 - don't use STL container directly, instead use CppUnit's wrapper located
24   in include/cppunit/portability. This help support compilers that don't 
25   support default template parameter and require an allocator to be 
26   specified.
27
28 - don't use default template parameters. If needed, use STLPort wrapper
29   technic (see include/cppunit/portability/).
30
31 - don't use templatized member functions (template method declared inside a
32   class), instead declares them as simple template functions (even
33   mainstream compiler such as VC++ 6 as trouble with them).
34
35 - don't use default parameter value in template function. Not supported
36   by all compiler (on OS/390 for instance).
37
38 - don't use STL container at() method, instead use the array accessor [].
39   at() is not supported on some gcc versions.
40
41 - dereferencing containers must be done by (*ref_ptr).data instead of
42   ref_ptr->data.
43
44 In brief, it should be possible to compile CppUnit on a C++ compiler that do
45 not have the following features:
46 - C++ style cast
47 - mutable and typename keyword
48 - RTTI
49 - template default parameters
50 - templatized member functions (that is a template function declared within a
51   class).
52 - namespace
53
54 As such, usage of those features should always be optional.
55
56 Following those guidelines should allow to compile on most compilers, as long
57 as STL are available (in std namespace or not), with some form of strstream and
58 iostream, as well as exception support.
59
60 --
61 Baptiste Lepilleur <gaiacrtn@free.fr>