Skip to content

Instantly share code, notes, and snippets.

@RichardB01
Last active May 28, 2020 11:08
Show Gist options
  • Save RichardB01/7e2a026730c4e59d327ae1a4f44dad70 to your computer and use it in GitHub Desktop.
Save RichardB01/7e2a026730c4e59d327ae1a4f44dad70 to your computer and use it in GitHub Desktop.
Example c++ naming conventions from the book "Code Complete - 2nd Edition"
/*
Macros
*/
#define DEBUG(x) printf("%s\r\n", x)
#define THREADING_ENABLED false
/*
Constant
*/
static const uint32_t MAX_ID = 1000;
/*
Global
*/
static uint32_t g_IdCounter = 0;
void IncrementIdCounter()
{
g_IdCounter++;
}
/*
Enumerators
*/
enum Identities
{
Identity_Manager,
Identity_Customer
};
/*
Class
*/
class ExampleClass
{
public:
uint32_t GetId()
{
return m_Id;
}
void SetID(uint32_t id)
{
m_Id = id;
}
private:
uint32_t m_Id = 0;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment