Last active
May 28, 2020 11:08
-
-
Save RichardB01/7e2a026730c4e59d327ae1a4f44dad70 to your computer and use it in GitHub Desktop.
Example c++ naming conventions from the book "Code Complete - 2nd Edition"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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