html code
font. File name example cisThisIsMyFile.h and code
example int myVariable;._ or dash -).
Example: cisIntVec3.h.h for headers and .cpp
for source files.#ifndef _cisMyClass_h #define _cisMyClass_h
#endif at the end of each include
file.cisMyClass-inl.h file.cisMyClass-inl.h) must be included
only by the corresponding header file
(cisMyClass.h). To prevent any other inclusion, we
recommend to add at the end of the declaration file
(cisMyClass.h): #define _cisMyClass_inl_h #include <cisMyClass-inl.h> #undef _cisMyClass_inl_hThe code of inline methods itself is in
cisMyClass-inl.h and the file should have, right after
the standard header: #ifndef _cisMyClass_inl_h #error "include of cisMyClass-inl.h is not allowed, include cisMyClass.h instead" #endif #undef _cisMyClass_inl_h
cisMyClass-tpl.h and the guard name is
_cisMyClass_tpl_hcisMyTetrahedron and
not MyTet.SignedVolume and not
SigVol.signedVolume.
cisSWAP_ARRAYS.#define or
enumerations should be all uppercase with underscore for separation
between words. Again, we use the package name in lower case as
prefix. Example: mrcMY_CONSTANT.cisTetrahedron tm.Tetrahedron()m.TetrahedrontetrahedroncisMAX(a, b)cisREDint firstIndex; int* secondIndex;and not:
int firstIndex, *secondIndex;
* or
the * with the type, not with the variable name.
Examples: int* index not int *index and
cisMyClass& object not cisMyClass
&object.condition?statement1:statement2i += *j.,) or a semi colon
(;). Example: for (i = 0; i > 10; i++)
but not for(i=0;i>10;i++).for, while,
switch or if and the following
parenthesis..
cisMyClassReturned
cisMyVeryLongClassName::AnEvenLongerMethodName(const cisOtherClass& object1,
const cisAnOtherVeryLongClassName& object2)
const
void if there is no parameter. Example:
int GetX(void) not int GetX()
if (myFlag == true)
{
return false;
} can also be written as
if (myFlag == true) {
return false;
}
int
cisGetIndexPointer(void)
const
{
return cisGlobalExternObject->IndexPointer;
}
__GNUC__!__GNUC__ tested with CC__SUNPRO_CC to be tested_MSC_VER (to be tested)unix tested for gcc/linux, gcc/irix,
gcc/solaris with "gnu cpp -dM"linux
tested for gcc with "cpp -dM"mips or
sgi (tested for gcc and CC)sparc or sun (tested for
gcc)WIN32 or
_WIN32for statements since
compilers have different ways to interpret them. Therefore,
statement like for (int i; i < 10; i++) MUST be
avoided.bool, true and
false.#include
<MaTh.h> but others won't (Solaris, Linux, Irix,
etc.).#endif of an include
file (.h). Please add a blank line.if/then/else,
condition?statement1:statement2 should not be used for at
least two reasons: readability and debugging. It is a clear example
of multiple instructions on a single line.assert macro is encouraged but the
condition must not have any "side effect" otherwise the released
version will not act like the debug version.goto.;) after a curly bracket
(}) except at the end of a class declaration.return, don't use unnecessary parenthesis. It's a
keyword, not a function.file1.h should be exported by the Dll
file1.dll which contains the object code of
file1.obj compiled from file1.cpp (which
includes file1.h, who's lost?). But the same symbol is
imported when compiling a program or a Dll relying on symbols defined
in file1.h. So, the macro definition is based on the
context and there must be an external flag (preprocessor defined
variable) which tells us if we are using some Dlls or compiling a
specific Dll.CIS_DLL so that all included header files use
_declspec(dllimport). For the compilation of a Dll we need to set
CIS_DLL_<MODULE> (e.g. for CISVecs, set
CIS_DLL_VECS). Each module (equivalent to library or
Dll) must have its own file to defines the import/export macros. This
file is named <PACKAGE><Module>Export.h
(e.g. CISVecsExport.h).cisEXPORT: For a variable, must be used in header
file with syntax: extern cisEXPORT typename varname.
The source file is not modified.cisEXPORT: For a function, must be used in header
file with syntax: cisEXPORT returntype functionname().
The source file is not modified.cisEXPORT: For a class, must be used in header
file with syntax: class cisEXPORT classname(). The
source file is not modified..o, .a or .so) and do
file myFile.o. The result is human readable.SGI_ABI set either to
-32 or -64. An other solution is to use
the option -32 or -64 for both compile and
link.-mabi=64 (default is 32 bits).