fork download
  1. #include <iostream>
  2. #define DEBUG
  3.  
  4. using namespace std;
  5. #ifdef DEBUG
  6. #define DECLARE_DEBUG_PARAM(...) __VA_ARGS__
  7. #define PASS_DEBUG_PARAM(...) __VA_ARGS__
  8. #else
  9. #define DECLARE_DEBUG_PARAM(...)
  10. #define PASS_DEBUG_PARAM(...)
  11. #endif
  12.  
  13. int foo1(DECLARE_DEBUG_PARAM(const bool param)) {
  14. #ifdef DEBUG
  15. if(param) {
  16. cout << "DEBUG true\n";
  17. } else {
  18. cout << "DEBUG false\n";
  19. }
  20. #else
  21. cout << "RETAIL\n";
  22. #endif
  23. }
  24.  
  25. int foo2(int DECLARE_DEBUG_PARAM(, const bool param)) {
  26. #ifdef DEBUG
  27. if(param) {
  28. cout << "DEBUG true\n";
  29. } else {
  30. cout << "DEBUG false\n";
  31. }
  32. #else
  33. cout << "RETAIL\n";
  34. #endif
  35. }
  36.  
  37. int main() {
  38.  
  39. foo1(PASS_DEBUG_PARAM(true));
  40. foo2(0 PASS_DEBUG_PARAM(,true));
  41.  
  42. return 0;
  43. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
DEBUG true
DEBUG true