Programming Conventions

NO CAMEL CASE.

Types, functions and methods are capitalized (e.g. DumbFunc ). Variables are lowercase with underscores (e.g. awesome_integer ). Enums and preprocessor macros are uppercase with underscores (e.g. SMELLY_HIPPO ). The whole Xrb library (with exception of Pal implementations, and possibly other stuff that I'm forgetting) is contained within the Xrb namespace. All preprocessor macros defined by the library are prefixed by XRB_ (or at least they should be).

Global variables are prefixed by g_ , member variables are prefixed by m_ , static variables are prefixed by s_ , and static global and static member variables are prefixed by gs_ and ms_ respectively (the most common one is FloatVector2::ms_zero ).

Assertions are used liberally throughout this codebase (see ASSERT0 through ASSERT3 ), and their liberal use is highly recommended throughout yours. They go away in release builds (except for ASSERT0 ), so there's no real penalty for using them besides perhaps uglying up your code a bit. This inconvenience is far outweighed by their benefits.

The const keyword is used as much as is appropriate (especially when passing structures as parameters to functions/methods). Its use in qualifying methods as "not changing the object" are emphasized. In general, const-correctness is a central tenet in this codebase.

Templates are used without reservation, though from the game developer's perspective (as opposed to the engine developer's) they are mostly hidden away in the library, with the exception of certain UI widgets and other systemmy stuff (e.g. StateMachine ).

Everything except the Pal implementations are housed within the namespace for your collision-free enjoyment. Or morally corrupted disappointment, if you're one of those weird people who likes dealing with that sort of thing.


Hosted by SourceForge.net Logo -- Generated on Fri Aug 21 21:46:38 2009 for XuqRijBuh by doxygen 1.5.8