Wiki Markup |
---|
Care must be taken to make sure that included header filenamesfile names are unique. According to C99 \[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\]: |
...
- Only the first eight characters in the filename file name are guaranteed to be significant.
- The file has only one, nondigit character after the period in the filenamefile name.
- The case of the characters in the filename file name is not guaranteed to be significant.
To guarantee that header filenames file names are unique, all included files should differ (in a case insensitive manner) in their first eight characters or in their (one character) file extension.
Note that this recommendation does not require that short filenames file names are used, only that the filenames file names are unique.
Non-Compliant Code Example
...
PRE08-EX1: While C99 only requires eight significant characters, most modern systems have long filenamesfile names, and compilers on such systems can typically differentiate them. Consequently, long filenames file names in headers may be used, provided that all the implementations to which the code is ported can distinguish between these filenamesfile names.
Risk Assessment
Failing to guarantee uniqueness of header files may result in the inclusion of an older version of a header file, which may include incorrect macro definitions or obsolete function prototypes or result in other errors that may or may not be detected by the compiler. Portability issues may also stem from the use of header names that are not guaranteed to be unique.
...