vi******@gmail.com wrote:
Is this a valid implementation of stdio.h?
-- stdio.h --
#ifndef __STDIO_H
#define __STDIO_H
/* all the necessary declarations etc */
void __dummy(void);
void __dummy(void) { return;
#include "closebracket.h"
#endif /* __STDIO_H */
-- stdio.h --
-- closebracket.h --
}
-- closebracket.h --
And if this is valid, how many files can stdio.h include and remain to
be valid?
5.2.4.1 mentions a requirement of at least 15 nesting levels of
#included files.
Is it the sum of both the implementations inclusions and the
programmers inclusions?
No.
What it says, applies to programs.
5.2.4.1 Translation limits
[#1] The implementation shall be able to translate and
execute at least one program that contains at least one
instance of every one of the following limits:
The text of an implementation's headers isn't part of a C program.
N869
5.1 Conceptual models
5.1.1 Translation environment
5.1.1.1 Program structure
[#1] A C program need not all be translated at the same
time. The text of the program is kept in units called
source files, (or preprocessing files) in this International
Standard. A source file together with all the headers and
source files included via the preprocessing directive
#include is known as a preprocessing translation unit. After
preprocessing, a preprocessing translation unit is called a
translation unit. Previously translated translation units
may be preserved individually or in libraries. The separate
translation units of a program communicate by (for example)
calls to functions whose identifiers have external linkage,
manipulation of objects whose identifiers have external
linkage, or manipulation of data files. Translation units
may be separately translated and then later linked to
produce an executable program.
--
pete