include - Does GCC protect programmer from multiple including of C's library headers? -
Is there a guarantee that every library header looks like this?
#ifndef STDIO_H #define STDIO_H / * content here ... * / #endif
Can you refer me to a source?
Thank you! No, the GCC does not protect you from the library, in which the guards included are not included - you described it - It is up to the library in question. (And not part of GCC.)
All major C standard libraries (GLBK, NULLBB, ULBACK) have to be incorporated correctly (as they are widely used, in this way A major problem will be discovered soon.)
Edit: After your second comment, your question is now more understandable. ISO / IEC 9899: 1999 (C 99), Criteria for Chapter 7.1.2, Four Paragraphs, First Sentence:
Standard Headers can be included in any order; Each can be included more than once in the given area, except by having only one time effect, except that & lt; Assert.h & gt; Depends on the definition of NDEBUG (see 7.2).
This means, if you have a standard C library, you have trouble, it is broken.
Comments
Post a Comment