fork(1) download
  1. void
  2. test_switch(int i)
  3. {
  4. static int state;
  5.  
  6. switch (i) {
  7. case 1:
  8. if (some_condition)
  9. some_function();
  10. else
  11. break;
  12. /* Падаем, если some_condition != 0 */
  13. case 0:
  14. state = 0;
  15. return;
  16. }
  17.  
  18. other_function();
  19. }
  20.  
  21. void
  22. test_goto(int i)
  23. {
  24. static int state;
  25.  
  26. if (i == 1 && some_condition)
  27. goto callf;
  28. else if (i == 0)
  29. goto reset;
  30.  
  31. other_function();
  32. return;
  33.  
  34. callf: some_function();
  35. reset: state = 0;
  36. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'test_switch':
prog.c:8:8: error: 'some_condition' undeclared (first use in this function)
    if (some_condition)
        ^
prog.c:8:8: note: each undeclared identifier is reported only once for each function it appears in
prog.c:9:5: warning: implicit declaration of function 'some_function' [-Wimplicit-function-declaration]
     some_function();
     ^
prog.c:18:3: warning: implicit declaration of function 'other_function' [-Wimplicit-function-declaration]
   other_function();
   ^
prog.c:4:14: warning: variable 'state' set but not used [-Wunused-but-set-variable]
   static int state;
              ^
prog.c: In function 'test_goto':
prog.c:26:17: error: 'some_condition' undeclared (first use in this function)
   if (i == 1 && some_condition)
                 ^
prog.c:24:14: warning: variable 'state' set but not used [-Wunused-but-set-variable]
   static int state;
              ^
stdout
Standard output is empty