Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //*
- [code here]
- //*/
- // in the following , foo() is active:
- /**/ foo(); /*/ bar(); /**/
- // now bar() is active:
- /*/ foo(); /*/ bar(); /**/
- #ifdef ENABLE_TESTS
- // code that you want to run ONLY during tests
- #endif
- $ gcc -DENABLE_TESTS source.c
- #if 0
- ...disabled code here
- #endif
- //* <-- remove the first slash
- [code block 1]
- /*/
- [code block 2]
- //*/
- [code block 1]
- if (0)
- {
- [code block 1]
- }
- else
- {
- [code block 2]
- }
- #if 0
- //code goes here
- #endif
- bool debugging = false;
- // banana banana banana
- if (debugging)
- {
- // do a bunch of stuff here
- }
- void doNothing(){}
- #define DO_IF(flag, code) flag ? code : doNothing();
- DO_IF(collectStats, recordStats());
- DO_IF(collectStats, store(pullStat()));
- #define DO_IF(flag,code) if( flag ) { code; }
- #define COMPILE
- #ifdef COMPILE
- //code to comment begins
- cout<<"ha ha ha"<<endl;
- //code to comment ends
- #endif
- 1 ? foo() : bar();
- if(isMode1)
- {
- //Code for mode1
- }
- else
- {
- //Code for other modes
- }
- #define CRAZY_EXPERIMENT
- #ifdef TEST
- #include "Test.h"
- #elif ANOTHER_TEST
- #include "AnotherTest.h"
- #elif CRAZY_EXPERIMENT
- #include "CrazyExperiment.h"
- #else
- int main(int argc, int * argv[]){
- runTheProgramLikeNormal();
- }
- #endif
- #ifdef _DEBUG
- #define IF_DEBUG(x) if(x)
- #else
- #define IF_DEBUG(x) if(false)
- #endif
- #include "debug.hpp"
- int a,b, ... ,z;
- ...
- IF_DEBUG(... regular_expression_here_with_a_b_z ...) {
- // set of asserts
- assert(... a ...);
- assert(... b ...);
- ...
- assert(... z ...);
- }
- IF_DEBUG(... regular_expression_here_with_a_b_z ...) {
- // set of asserts
- assert(... a ...);
- assert(... b ...);
- ...
- assert(... z ...);
- }
- else {
- (void)a;
- (void)b;
- ....
- (void)z;
- }
Add Comment
Please, Sign In to add comment