preprocessor #include

V

vippstar

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? And if so, does that mean the programmer
cannot portably have more than 1 nesting level, since the
implementation is free to use 62 nesting levels?

Thanks for all the replies.
 
V

vippstar

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? And if so, does that mean the programmer
cannot portably have more than 1 nesting level, since the
implementation is free to use 62 nesting levels?
Whoops, 14 nesting levels.
 
T

Thad Smith

Whoops, 14 nesting levels.

Since the user doesn't have control over the nesting levels of system
headers, I interpret the constraint to mean that the user can nest 14
#include files, then #include any system header.

As the implementor, you can nest the system headers as deeply as you like,
as long as you can accommodate the limit, with system header counting as
one level.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,616
Members
45,306
Latest member
TeddyWeath

Latest Threads

Top