fork download
  1. #include <iostream>
  2.  
  3. #define OUT(x) if((y = x > 0 ? x : y), x > 1) cout << x+1
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. int y = 0;
  9. OUT(0) << "message"; // OK
  10. cout << y << endl;
  11.  
  12. OUT(1) << "message"; // OK
  13. cout << y << endl;
  14.  
  15. OUT(2) << "message"; // OK
  16. cout << y << endl;
  17.  
  18. if(0) {
  19. OUT(2) << "message"; // OK, nothing printed
  20. }
  21.  
  22. cout << y << endl;
  23.  
  24. if(0)
  25. OUT(3) << "message"; // Nothing printed as well
  26.  
  27. cout << y << endl;
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
0
1
3message2
2
2