Version 1 (modified by leo, 11 years ago) (diff)


Even though the source code currently doesn't always follow these rules, any new code written should follow them. Old code not following the conventions will eventually get updated with the current conventions whenever it needs to be changed.

Coding Style

  • Use tabs up until the first margin, after that use spaces to have everything line up correctly with any editor settings.
  • Keep braces on their own line (1 line functions can skip this rule).
  • Function arguments should have spaces after commas, but not before/after the parenthesis.
  • Add spaces before and after math operators.
  • All variables and functions should be mixed case without underscores.
  • Defines and enums should be uppercase and prefixed with LC_.
  • Prefix class member variables with m_.
  • Any code shared by all platforms should go in the common directory, platform specific code goes into the respective platform directory.
  • Avoid using platform #ifdef's, if a function is different for each platform it should be in the platform directory.
  • Never check in code with compiler warnings or errors.

File Conventions

  • All binary files are always written as little endian files, even on big endian computers.
  • Use the File class for reading/writing files to make sure they are endian swapped correctly.
  • Use the lcuint32 etc types for structures that are saved to make sure they can be loaded under different platforms.