Skip to content

Instantly share code, notes, and snippets.

@bilderbuchi
Created August 22, 2012 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bilderbuchi/3424179 to your computer and use it in GitHub Desktop.
Save bilderbuchi/3424179 to your computer and use it in GitHub Desktop.
tweaked OF code style
// Correct
#ifdef WIN32
#define IS_WIN32
#endif
#ifndef TARGET_LINUX
doSomething();
#define TARGET_LINUX
#endif
#define MY_CONSTANT
ofSomeClass::doSomething(){
//this should not be indented
#if !defined(TARGET_LINUX) && !defined(MAC_OS_X_VERSION_10_7)
doThis(); //indent to class level
int myInt = 5;
#define MY_CONSTANT2
#if defined MY_CONSTANT
doMyConstantStuff();
#endif
#else //this should not be indented
doThat(); //indent to class level
int myInt = 10;
#endif //this should not be indented
//define is still indented at correct level
#define MAC_OS_X_VERSION_10_7
finishUp();
}
// Correct
#ifdef WIN32
#define IS_WIN32
#endif
#ifndef TARGET_LINUX
doSomething();
#define TARGET_LINUX
#endif
#define MY_CONSTANT
ofSomeClass::doSomething(){
//this should not be indented
#if !defined(TARGET_LINUX) && !defined(MAC_OS_X_VERSION_10_7)
doThis(); //indent to class level
int myInt = 5;
#define MY_CONSTANT2
#if defined MY_CONSTANT
doMyConstantStuff();
#endif
#else //this should not be indented
doThat(); //indent to class level
int myInt = 10;
#endif //this should not be indented
//define is still indented at correct level
#define MAC_OS_X_VERSION_10_7
finishUp();
}
// Correct
#ifdef WIN32
#define IS_WIN32
#endif
#ifndef TARGET_LINUX
doSomething();
#define TARGET_LINUX
#endif
#define MY_CONSTANT
ofSomeClass::doSomething(){
//this should not be indented
#if !defined(TARGET_LINUX) && !defined(MAC_OS_X_VERSION_10_7)
doThis(); //indent to class level
int myInt = 5;
#define MY_CONSTANT2
#if defined MY_CONSTANT
doMyConstantStuff();
#endif
#else //this should not be indented
doThat(); //indent to class level
int myInt = 10;
#endif //this should not be indented
//define is still indented at correct level
#define MAC_OS_X_VERSION_10_7
finishUp();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment