Coding conventions |
The following conventions are used throughout the C++ source code:
Use the following naming and case conventions:
When defining a data type my_type which is really a pointer to the representation class my_type_rep, use the standard mechanism for defining reference counted pointer classes. In the case of a simple class my_type, this is done using the following kind of code:
In the case of template classes, one should use similar macros INDIRECT_PROTO_1, etc.
To increase conciseness, we systematically abbreviate template definitions and template type names when defining new template classes. For instance, the code of the list<C> class is enclosed in a block of the form:
There are probably more convention; please follow the style of existing code when writing new packages.
Static variables. The use of static variables in C++ can lead to weird effects within memory initialization and destruction. Their use is thus depreciated. For a local usage nesting a static variable inside a function that returns a read/write reference to the variable is often a good solution, for instance:
In case you run into a “segmentation fault” within the mmx-light shell, you can use gdb as follows, assuming that you are in development mode:
In this way you will find the location of the crash inside the C++ source code. In order to obtain more information you must recompile the package involved with the –enable-debug option:
An other convient way to launch the debugger just after an mmx-light session has crashed is as follows: