8,567
edits
No edit summary |
m (wiki links) |
||
Line 1: | Line 1: | ||
This page collects various tips and common pitfalls when working with the C++ code. Some are generic, others are FlightGear specific | This page collects various tips and common pitfalls when working with the '''C++''' code. Some are generic, others are [[FlightGear]] specific | ||
== Primitive Types == | == Primitive Types == | ||
* Use the SimGear primitive types for quaternions, vectors and matrices - the PLIB ones are deprecated (and PLIB will be removed at some point in the future). In some places it makes sense to use OSG types directly - that decision is left to the developer to decide which makes more sense. | * Use the [[SimGear]] primitive types for quaternions, vectors and matrices - the [[PLIB]] ones are deprecated (and PLIB will be removed at some point in the future). In some places it makes sense to use [[OSG]] types directly - that decision is left to the developer to decide which makes more sense. | ||
* Use the [http://www.boost.org/doc/libs/1_40_0/doc/html/string_algo.html boost helpers] for string manipulation - they're more portable than C-library functions, especially on non-Unix systems. | * Use the [http://www.boost.org/doc/libs/1_40_0/doc/html/string_algo.html boost helpers] for string manipulation - they're more portable than C-library functions, especially on non-Unix systems. | ||
Line 22: | Line 22: | ||
** an <tt>#ifndef</tt> guard | ** an <tt>#ifndef</tt> guard | ||
** a one line comment stating the purpose of the file (or a full Doyxgen @file block if you prefer) | ** a one line comment stating the purpose of the file (or a full Doyxgen @file block if you prefer) | ||
** The GPL license boiler plate | ** The [[GPL]] license boiler plate | ||
** The CVS revision tag | ** The [[CVS]] revision tag | ||
** any required includes, ideally grouped by kind - for example standard C library, then standard C++ library, then SimGear, then other FlightGear headers | ** any required includes, ideally grouped by kind - for example standard C library, then standard C++ library, then SimGear, then other FlightGear headers | ||
** any forward declarations or namespaces required | ** any forward declarations or namespaces required |