Coding conventions for CHAI 3D


[Whitespace] [Symbol names] [Comments] [Header files] [Tips]

Rather than enumerate the format of every possible line you might write in C++, I'll try to point out specific aspects of the CHAI coding conventions that might not be considered 'standard' C++ style. And of course, the best reference is the code itself; if you start from an existing CHAI file as a stencil, you'll find it hard _not_ to stick to the conventions.


Whitespace and indents


File, class, variable, and function names


Comments


Header files


Coding/Performance tips


As promised, the big CHAI header comment to be included at the top of every file:

//===========================================================================
/*
    This file is part of the CHAI 3D visualization and haptics libraries.
    Copyright (C) 2003-2004 by CHAI 3D. All rights reserved.

    This library is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License("GPL") version 2
    as published by the Free Software Foundation.

    For using the CHAI 3D libraries with software that can not be combined
    with the GNU GPL, and for taking advantage of the additional benefits
    of our support services, please contact CHAI 3D about acquiring a
    Professional Edition License.

    \author:    <http://www.chai3d.org>
    \author:    Joe Smith 
    \version    1.1
    \date       01/2004
*/
//===========================================================================


Written by
Dan Morris, September 2004