headers.txt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. This file documents some conventions for sorting system header files in
  2. the #include section.
  3. 1. #include <config.h> unconditionally
  4. 2. if there are any headers containing "alloca" in the name, include
  5. them here. Some systems need them as the first header.
  6. 3. #include the Standard C Library headers, sorted alphabetically
  7. (assert, ctype, errno, float, limits, locale, math, setjmp, signal,
  8. stdarg, stddef, stdio, stdlib, string, time)
  9. 4. #include the POSIX headers, in the following order
  10. <sys/types.h> Needed by many other headers.
  11. <sys/*.h>
  12. <*.h>
  13. For every POSIX function you use, make sure that the order of the
  14. headers is the same as in the according manpage.
  15. 5. #include other external headers
  16. 6. #include "../src/global.h"
  17. This file contains lots of compatibility stuff that is used
  18. throughout the whole mc. All mc header files rely on this file to be
  19. included before them.
  20. 7. #include Midnight Commander headers
  21. Currently, not all headers can be ordered arbitrarily, so try it out.
  22. ==== Headers that may be included unconditionally ====
  23. All ISO C90 headers.
  24. <sys/types.h>
  25. <sys/stat.h>
  26. <unistd.h>
  27. <fcntl.h>
  28. ==== Headers that need autoconf guards ====
  29. <termios.h>
  30. <sys/ioctl.h>