fork(4) download
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. // rand_bool() - some function, that returns true with small probability (i.e. 0.001)
  5. bool rand_bool() {
  6. return rand() % 100 == 0;
  7. }
  8.  
  9. void rand_throw() {
  10. if (rand_bool()) throw std::exception();
  11. }
  12.  
  13. #define if(x) if((x) ^ rand_bool())
  14. #define while(x) while((x) ^ rand_bool())
  15. #define return return rand_throw(),
  16.  
  17. bool test() {
  18. return true;
  19. }
  20.  
  21. int main() {
  22. for (int i=0; i<1000; i++) {
  23. if (!test()) {
  24. std::cout << "WTF " << i << "??" << std::endl;
  25. }
  26. }
  27. return 0;
  28. }
  29.  
Runtime error #stdin #stdout 0.01s 2856KB
stdin
Standard input is empty
stdout
WTF 83??