fork download
  1. int create_server_socket(...) {
  2. int ret, fd;
  3.  
  4. fd = socket(...);
  5. if (fd < 0) {
  6. ret = -ERROR_SOCKET;
  7. goto FAIL_RETURN;
  8. }
  9.  
  10. ret = bind(...);
  11. if (ret < 0) {
  12. ret = -ERROR_BIND;
  13. goto FAIL_CLOSE_AND_RETURN;
  14. }
  15.  
  16. ret = listen(...);
  17. if (ret < 0) {
  18. ret = -ERROR_LISTEN;
  19. goto FAIL_CLOSE_AND_RETURN;
  20. }
  21.  
  22. ret = accept(...);
  23. if (ret < 0) {
  24. ret = -ERROR_ACCEPT;
  25. goto FAILE_CLOSE_AND_RETURN;
  26. }
  27.  
  28. FAIL_CLOSE_AND_RETURN:
  29. close(fd);
  30. FAIL_RETURN:
  31. return ret;
  32. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:26: error: ISO C requires a named argument before ‘...’
 int create_server_socket(...) {
                          ^
prog.c: In function ‘create_server_socket’:
prog.c:4:3: warning: implicit declaration of function ‘socket’ [-Wimplicit-function-declaration]
   fd = socket(...);
   ^
prog.c:4:15: error: expected expression before ‘...’ token
   fd = socket(...);
               ^
prog.c:6:12: error: ‘ERROR_SOCKET’ undeclared (first use in this function)
     ret = -ERROR_SOCKET;
            ^
prog.c:6:12: note: each undeclared identifier is reported only once for each function it appears in
prog.c:10:3: warning: implicit declaration of function ‘bind’ [-Wimplicit-function-declaration]
   ret = bind(...);
   ^
prog.c:10:14: error: expected expression before ‘...’ token
   ret = bind(...);
              ^
prog.c:12:12: error: ‘ERROR_BIND’ undeclared (first use in this function)
     ret = -ERROR_BIND;
            ^
prog.c:16:3: warning: implicit declaration of function ‘listen’ [-Wimplicit-function-declaration]
   ret = listen(...);
   ^
prog.c:16:16: error: expected expression before ‘...’ token
   ret = listen(...);
                ^
prog.c:18:12: error: ‘ERROR_LISTEN’ undeclared (first use in this function)
     ret = -ERROR_LISTEN;
            ^
prog.c:22:3: warning: implicit declaration of function ‘accept’ [-Wimplicit-function-declaration]
   ret = accept(...);
   ^
prog.c:22:16: error: expected expression before ‘...’ token
   ret = accept(...);
                ^
prog.c:24:12: error: ‘ERROR_ACCEPT’ undeclared (first use in this function)
     ret = -ERROR_ACCEPT;
            ^
prog.c:29:3: warning: implicit declaration of function ‘close’ [-Wimplicit-function-declaration]
   close(fd);
   ^
prog.c:25:5: error: label ‘FAILE_CLOSE_AND_RETURN’ used but not defined
     goto FAILE_CLOSE_AND_RETURN;
     ^
stdout
Standard output is empty