maximum header file size

S

Serve Laurijssen

Does the standard say something about the maximum size of a header? I
couldnt find something about it in the implementation defined section.
 
S

Serve Laurijssen

Richard Heathfield said:
The Standard imposes no upper limits on implementations. What it does
impose is the lower limits of implementation-specific maxima. For
example, INT_MAX must be at least 32767, but can go as high as the
implementor likes.


Ah thats what I meant. The minimum required size a header file must be. Im
asking this because somebody generated a header file of 5MB and some
compiler refuses to compile it. But I couldnt find it in the standard
 
J

James Kuyper

Serve said:
Ah thats what I meant. The minimum required size a header file must be.
Im asking this because somebody generated a header file of 5MB and some
compiler refuses to compile it. But I couldnt find it in the standard

Implementations are allowed to have limits on the programs they can
handle. They are only required to translate and execute correctly one
program - but this one program must meet certain minimum requirements
specified in 5.2.4.1p1. Therefore, any implementation with a hard limit
that corresponds to one of the specified minimums must set that hard
limit to a value equal to or greater than that minimum value. Note,
however, that none of those minimums corresponds directly to the size of
the source code files.

In most cases, those minimums correspond to data structures set up by
the compiler that can be, and probably are, dynamically allocated.
Instead of 22 different hard-coded limits, there's often just one soft
limit: the compiler must fail if one of the dynamic allocations fails.
It's easy to come up with a "one program" meeting the requirements of
5.2.4.1p1 that puts quite minimal strains on the total memory required.
I can easily believe that, on some small systems, a compiler that is
fully conforming because it can handle it's "one program", might
nonetheless run out of memory while handling a 5MB header file.
 
K

Keith Thompson

Serve Laurijssen said:
Ah thats what I meant. The minimum required size a header file must
be. Im asking this because somebody generated a header file of 5MB and
some compiler refuses to compile it. But I couldnt find it in the
standard

How exactly did the compiler fail?

If it generated an explicit message, something like "Translation
unit exceeds 5 megabytes", then that probably a limit explicitly
imposed by the compiler (and it's within its rights to do so).
If the compiler crashed with an OS out-of-memory error, then you
might be able to compile it by increasing the resources available
to the compiler.

You might have gotten the information you need more quickly if, in
addition to the question you asked, you had also written something
like "My compiler fails when I try to compile a 5MB header file;
here's the error message".
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top