Coding Style

The dev code on this site is mostly in C++ and uses a coding style to ensure that my code is consistent and readable. This coding style is briefly described in the empty classes that are linked to this page. Please view code links in Chrome as its default way end of handling end of lines is more readable than some other browsers.

To begin, I’ve defines for all the basic data types like floating point numbers, booleans and unsigned integers (etc). These defines are included in BtTypes.h. This header is particularly convenient when it comes to specifying particular sizes of integers or floats, for example, you would normally define a 64 bit unsigned integer using unsigned __int64. Instead, this coding style uses BtU64 which is much shorter.

For example, if you want to define a set of variables you would use the code:

#include “BtTypes.h”

BtFloat s_secondsElapsed;
BtU32 s_numBoids;
BtBool s_isSetup;

New code is placed in its own class. The class name starts with an acronym of the project, followed by a description of the class. The example class is called SbBoids. It’s a Boids simulation from a Sandbox project.

An example of a C++ header is SbBoids.h.

An example of the C++ implementation file is SbBoids.cpp.