-
Notifications
You must be signed in to change notification settings - Fork 1
Code Guidelines
Tim Lane edited this page Feb 4, 2019
·
10 revisions
- Indentation brackets { and } should always be on a new line (for sake of consistency)
- Always add a copy constructor and assignment operator = overload to classes, UNLESS creating a simple utility class with no pointers (e.g. Timer). By default these should be encapsulated as private so that copies may not be made (with some exceptions, e.g. classes that instantiate to objects with low-memory usage). Note: I've made a helper macro (include helpermacros.h) called NOCOPY() which declares a private copy and assignment operator.
- Wrap new classes and files with the
ossiumnamespace. - Cache the count when using
forloops, e.g.for (int i = 0, counti = myarray.GetSize(); i < counti; i++) - Please use PascalCase for classes, methods and functions. camelCase is fine for members and variables. Avoid using underscores if you can, but in some circumstances it makes sense to use
© Tim Lane 2018-2020