fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void _gay();
  5. void _gay2();
  6.  
  7. void(*gay)() = _gay;
  8.  
  9.  
  10. void _gay()
  11. {
  12. printf("_gay\n");
  13. static bool inited = false;
  14. if (!inited)
  15. {
  16. printf("rare stuff here\n");
  17. gay = _gay2;
  18. inited = true;
  19. }
  20.  
  21. _gay2();
  22. }
  23.  
  24. void _gay2()
  25. {
  26. printf("_gay2\n");
  27. printf("actual work\n");
  28. }
  29.  
  30.  
  31. int main() {
  32. gay();
  33. gay();
  34. return 0;
  35. }
Success #stdin #stdout 0s 4384KB
stdin
Standard input is empty
stdout
_gay
rare stuff here
_gay2
actual work
_gay2
actual work