Coding standards

I’m having to decide on some coding standards that are to my liking. If you have any suggested amendments I’d love to hear them.

Header Files

  • Don’t use “#pragma once”, this is Windows specific
  • Use #ifndef and macro definitions as they are suitable for all environments.
  • Don’t use “using namespace” within header (.h) files, only code files (.cpp)

Global Variables

  • Global variables should be prefixed with “g_” and prefixed with a lowercase letter

Classes and Namespaces

  • Classes should be stored in suitable namespaces
  • Class and Function names should start with the first letter capitalised
  • Private class member variables – start with “m_” and the first letter is lowercase
  • Public class variables should begin with the first letter capitalised

Functions

  • Function parameters should start with a lowercase charachter

Pointers

  • Declare as null
  • Remember to deleted
  • Set to null again once deleted
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s