Warp Rogue Coding Style


Code should be clean, readable and simple. Efficiency is secondary. 

Language Standard: ANSI C90 + ISO C99 long identifiers

All declarations must be put at the beginning of a block. No exceptions.
No // comments. 

Use tabs / tab size = 8 spaces

Use K&R style bracing.

All code must pass the high warning level specified in the development makefiles without any warnings.

Identifiers: ideally consist of up to three non-abbreviated English words. You may use more words if it is necessary. 
local_variables_are_named_like_this
GlobalVariablesAreNamedLikeThis
CONSTANTS_AND_MACROS_ARE_NAMED_LIKE_THIS

Comments: one comment at the top of every function that describes what the function does. Other comments are only necessary if something NEEDS explanation and if that is the case you should probably rewrite your code.

Functions: should be short and do exactly one thing.
Break the functionality down into many small, well-defined parts.

Modules: see Functions.

No magic numbers.

Spaces around the mathematical, comparison, and assignment operators ('+', '-', '*', '/', '=', '!=', '==', '>', ...).

Spaces between C-identifiers like 'if', 'while', 'for', and 'return' and the opening brackets ('if (foo)', 'while (bar)', ...).

No spaces between function names and brackets and between brackets and function arguments (function(1, 2) instead of function ( 1, 2 )). 


File Layout


*.H FILE

[LICENSE]

[MODULE DESCRIPTION]

[EXPORTED DEFINES]

[PROTOTYPES FOR EXPORTED FUNCTIONS]


*.C FILE

[LICENSE]

[MODULE DESCRIPTION]

[MODULE DEPENDENCIES] (Uses_X entries)
#include [MAIN HEADER]

#include [MODULE HEADER]

[INTERNAL DEFINES]

[INTERNAL DATA TYPES]

[PROTOTYPES FOR INTERNAL FUNCTIONS]

[EXPORTED VARIABLES]

[INTERNAL VARIABLES]

[EXPORTED FUNCTIONS]

[INTERNAL FUNCTIONS]


