maximum header file size

Discussion in 'C Programming' started by Serve Laurijssen, Oct 16, 2009.

  1. Does the standard say something about the maximum size of a header? I
    couldnt find something about it in the implementation defined section.
     
    Serve Laurijssen, Oct 16, 2009
    #1
    1. Advertising

  2. "Richard Heathfield" <> schreef in bericht
    news:...
    > In <4ad8093f$0$1637$>, Serve Laurijssen wrote:
    >
    >> Does the standard say something about the maximum size of a header?
    >> I couldnt find something about it in the implementation defined
    >> section.

    >
    > 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
     
    Serve Laurijssen, Oct 16, 2009
    #2
    1. Advertising

  3. Serve Laurijssen

    James Kuyper Guest

    Serve Laurijssen wrote:
    >
    > "Richard Heathfield" <> schreef in bericht
    > news:...
    >> In <4ad8093f$0$1637$>, Serve Laurijssen wrote:
    >>
    >>> Does the standard say something about the maximum size of a header?
    >>> I couldnt find something about it in the implementation defined
    >>> section.

    >>
    >> 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


    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.
     
    James Kuyper, Oct 16, 2009
    #3
  4. "Serve Laurijssen" <> writes:
    > "Richard Heathfield" <> schreef in bericht
    > news:...
    >> In <4ad8093f$0$1637$>, Serve Laurijssen wrote:
    >>
    >>> Does the standard say something about the maximum size of a header?
    >>> I couldnt find something about it in the implementation defined
    >>> section.

    >>
    >> 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


    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".

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Oct 16, 2009
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gh0st54
    Replies:
    1
    Views:
    397
    Greg Burns
    Oct 13, 2004
  2. J055
    Replies:
    3
    Views:
    1,328
    Steven Cheng[MSFT]
    Jul 5, 2006
  3. uremae

    maximum file size of FOPEN

    uremae, May 19, 2005, in forum: C Programming
    Replies:
    15
    Views:
    8,743
  4. mlt
    Replies:
    2
    Views:
    854
    Jean-Marc Bourguet
    Jan 31, 2009
  5. phanhuyich
    Replies:
    4
    Views:
    280
Loading...

Share This Page