Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. /*
  2. * 오늘 우리가 배울 것은 __P 이다.
  3. *
  4. * __P에서 P는 Proto 를 뜻하는 것이다. 아래 코드를 보자.
  5. *
  6. */
  7.  
  8. # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) || defined (PROTOTYPES)
  9. # define __P(protos) protos
  10. # else
  11. # define __P(protos) ()
  12. # endif
  13.  
  14. /*
  15. * 위의 코드는 __P가 어떻게 정의되어있는지를 잘 보여준다.
  16. *
  17. * 보면, __STDC__, __GNUC__, __cplusplus, PROTOTYPES 가 정의되어있으면
  18. * __P(proto) 는 그냥 proto가 되는 것이고.
  19. * 위의 정의되어있지 않다면, 아무것도 아닌거다.
  20. */
  21.  
  22.  
  23. int test __P((int));
  24.  
  25. int main(int argc, char** argv)
  26. {
  27. printf("%d\n", test(1));
  28. return 0;
  29.  
  30. }
  31.  
  32. int test(int a)
  33. {
  34. return a;
  35. }
  36.  
  37. /*
  38. * 위와 같이 프로토 타입을 나열할 때 쓰인다.
  39. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement