What is a header?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steven T. Hatton

    What is a header?

    If a header is not necessarily a source file, and the sequences delimited by
    < and > in header names aren't necessarily valid source file names, what
    exactly is a header?
    --
    p->m == (*p).m == p[0].m

    Modernize your infrastructure with SUSE Linux Enterprise servers, cloud technology for IaaS, and SUSE's software-defined...

    Mozilla is the not-for-profit behind the lightning fast Firefox browser. We put people over profit to give everyone more power online.

  • Mike Wahler

    #2
    Re: What is a header?

    "Steven T. Hatton" <susudata@setid ava.kushan.aa> wrote in message
    news:h-OdnUdO8a5n7fHdR Vn-hQ@speakeasy.ne t...[color=blue]
    > If a header is not necessarily a source file, and the sequences delimited[/color]
    by[color=blue]
    > < and > in header names aren't necessarily valid source file names, what
    > exactly is a header?[/color]

    A set of declarations. The actual ultimate source of
    these declarations is unspecified. It's typically
    a file (often with the same name).

    -Mike


    Comment

    • Pete Vidler

      #3
      Re: What is a header?

      Steven T. Hatton wrote:[color=blue]
      > If a header is not necessarily a source file, and the sequences delimited by
      > < and > in header names aren't necessarily valid source file names, what
      > exactly is a header?[/color]

      From a compiler's perspective they don't exist. The preprocessor
      combines source and header files (via #include) into translation units.

      It's just a programmer convenience. It makes it easier to refer to
      common code between translation units by including all the
      interfaces/declarations into both.

      Everything else you'll see in there is simply the convention (or coding
      standards) that were used to write the program. Like where on the line
      you indent or put braces.

      -- Pete

      Comment

      • Julie

        #4
        Re: What is a header?

        "Steven T. Hatton" wrote:[color=blue]
        >
        > If a header is not necessarily a source file, and the sequences delimited by
        > < and > in header names aren't necessarily valid source file names, what
        > exactly is a header?[/color]

        A header is _necessarily_ a source file that is exclusively distinctly visible
        by the preprocessor.

        Comment

        • Steven T. Hatton

          #5
          Re: What is a header?

          Julie wrote:
          [color=blue]
          > "Steven T. Hatton" wrote:[color=green]
          >>
          >> If a header is not necessarily a source file, and the sequences delimited
          >> by < and > in header names aren't necessarily valid source file names,
          >> what exactly is a header?[/color]
          >
          > A header is _necessarily_ a source file that is exclusively distinctly
          > visible by the preprocessor.[/color]
          "A header is not necessarily a source file, nor are the sequences delimited
          by < and > in header names necessarily valid source file names (16.2)."
          ISO/IEC 14882:2003(E)
          --
          p->m == (*p).m == p[0].m

          Modernize your infrastructure with SUSE Linux Enterprise servers, cloud technology for IaaS, and SUSE's software-defined...

          Mozilla is the not-for-profit behind the lightning fast Firefox browser. We put people over profit to give everyone more power online.

          Comment

          • Kevin Goodsell

            #6
            Re: What is a header?

            Julie wrote:
            [color=blue]
            > "Steven T. Hatton" wrote:
            >[color=green]
            >>If a header is not necessarily a source file, and the sequences delimited by
            >>< and > in header names aren't necessarily valid source file names, what
            >>exactly is a header?[/color]
            >
            >
            > A header is _necessarily_ a source file that is exclusively distinctly visible
            > by the preprocessor.[/color]

            2.8 Header names [lex.header]
            header-name:
            <h-char-sequence>
            "q-char-sequence"
            h-char-sequence:
            h-char
            h-char-sequence h-char
            h-char:
            any member of the source character set except
            new-line and >
            q-char-sequence:
            q-char
            q-char-sequence q-char
            q-char:
            any member of the source character set except
            new-line and "

            1 Header name preprocessing tokens shall only appear within a #include
            preprocessing directive (_cpp.include_) . The sequences in both forms
            of header-names are mapped in an implementation-defined manner to
            headers or to external source file names as specified in
            _cpp.include_.



            16.2 Source file inclusion [cpp.include]

            1 A #include directive shall identify a header or source file that can
            be processed by the implementation.

            2 A preprocessing directive of the form
            # include <h-char-sequence> new-line
            searches a sequence of implementation-defined places for a header
            identified uniquely by the specified sequence between the < and >
            delimiters, and causes the replacement of that directive by the entire
            contents of the header. How the places are specified or the header
            identified is implementation-defined.


            I don't see anything here requiring headers to be files. In fact, it
            sounds like they went out of their way to make sure that was not implied
            (e.g., "header _or_ source file").

            -Kevin
            --
            My email address is valid, but changes periodically.
            To contact me please use the address from a recent posting.

            Comment

            • Julie

              #7
              Re: What is a header?

              "Steven T. Hatton" wrote:[color=blue]
              >
              > Julie wrote:
              >[color=green]
              > > "Steven T. Hatton" wrote:[color=darkred]
              > >>
              > >> If a header is not necessarily a source file, and the sequences delimited
              > >> by < and > in header names aren't necessarily valid source file names,
              > >> what exactly is a header?[/color]
              > >
              > > A header is _necessarily_ a source file that is exclusively distinctly
              > > visible by the preprocessor.[/color]
              > "A header is not necessarily a source file, nor are the sequences delimited
              > by < and > in header names necessarily valid source file names (16.2)."
              > ISO/IEC 14882:2003(E)[/color]

              I would have preferred you posting that with your original post.

              Comment

              • Steven T. Hatton

                #8
                Re: What is a header?

                Kevin Goodsell wrote:
                [color=blue]
                > I don't see anything here requiring headers to be files. In fact, it
                > sounds like they went out of their way to make sure that was not implied
                > (e.g., "header _or_ source file").
                >[/color]

                I have the feeling there is some ancient dark secret surrounding this issue
                that none of the oldtimers wants to talk about. I tried to ask about the
                history of research into alternatives to the traditional header file on
                comp.std.c++, but received no reply.

                --
                p->m == (*p).m == p[0].m

                Modernize your infrastructure with SUSE Linux Enterprise servers, cloud technology for IaaS, and SUSE's software-defined...

                Mozilla is the not-for-profit behind the lightning fast Firefox browser. We put people over profit to give everyone more power online.

                Comment

                • Alf P. Steinbach

                  #9
                  Re: What is a header?

                  * "Steven T. Hatton" <susudata@setid ava.kushan.aa> schriebt:[color=blue]
                  > Kevin Goodsell wrote:
                  >[color=green]
                  > > I don't see anything here requiring headers to be files. In fact, it
                  > > sounds like they went out of their way to make sure that was not implied
                  > > (e.g., "header _or_ source file").
                  > >[/color]
                  >
                  > I have the feeling there is some ancient dark secret surrounding this issue
                  > that none of the oldtimers wants to talk about.[/color]

                  No dark secrets.

                  [color=blue]
                  > I tried to ask about the
                  > history of research into alternatives to the traditional header file on
                  > comp.std.c++, but received no reply.[/color]

                  The current wording allows an implementation to implement standard
                  headers in other and perhaps more efficient ways than using files, like
                  like having e.g. <string> hardwired into the compiler.

                  Because of that it also allows non-file-based headers in general.

                  But as far as I know there are no commonly used implementations taking
                  advantage of this. In terms of designing the standard it's like the common
                  error of adding complexity to a class in order to support some imagined
                  future need which never actually materializes. So perhaps what you think
                  of as the "oldtimers" in [comp.std.c++] simply were a bit ashamed, or even
                  simpler, didn't think this important enough to waste time on.

                  --
                  A: Because it messes up the order in which people normally read text.
                  Q: Why is top-posting such a bad thing?
                  A: Top-posting.
                  Q: What is the most annoying thing on usenet and in e-mail?

                  Comment

                  • Steven T. Hatton

                    #10
                    Re: What is a header?

                    Alf P. Steinbach wrote:
                    [color=blue]
                    > * "Steven T. Hatton" <susudata@setid ava.kushan.aa> schriebt:[color=green]
                    >> Kevin Goodsell wrote:
                    >>[color=darkred]
                    >> > I don't see anything here requiring headers to be files. In fact, it
                    >> > sounds like they went out of their way to make sure that was not
                    >> > implied (e.g., "header _or_ source file").
                    >> >[/color]
                    >>
                    >> I have the feeling there is some ancient dark secret surrounding this
                    >> issue that none of the oldtimers wants to talk about.[/color]
                    >
                    > No dark secrets.
                    >
                    >[color=green]
                    >> I tried to ask about the
                    >> history of research into alternatives to the traditional header file on
                    >> comp.std.c++, but received no reply.[/color]
                    >
                    > The current wording allows an implementation to implement standard
                    > headers in other and perhaps more efficient ways than using files, like
                    > like having e.g. <string> hardwired into the compiler.
                    >
                    > Because of that it also allows non-file-based headers in general.
                    >
                    > But as far as I know there are no commonly used implementations taking
                    > advantage of this. In terms of designing the standard it's like the
                    > common error of adding complexity to a class in order to support some
                    > imagined
                    > future need which never actually materializes. So perhaps what you think
                    > of as the "oldtimers" in [comp.std.c++] simply were a bit ashamed, or even
                    > simpler, didn't think this important enough to waste time on.
                    >[/color]

                    There's an interesting epigraph at the beginning of chapter 18 in
                    TC++PL(SE). Form is liberating. - engineers' proverb.
                    --
                    p->m == (*p).m == p[0].m

                    Modernize your infrastructure with SUSE Linux Enterprise servers, cloud technology for IaaS, and SUSE's software-defined...

                    Mozilla is the not-for-profit behind the lightning fast Firefox browser. We put people over profit to give everyone more power online.

                    Comment

                    • John Doe

                      #11
                      Re: What is a header?

                      On Thu, 01 Apr 2004 17:10:38 -0500, Steven T. Hatton wrote:
                      [color=blue]
                      >
                      > I have the feeling there is some ancient dark secret surrounding this issue
                      > that none of the oldtimers wants to talk about. I tried to ask about the
                      > history of research into alternatives to the traditional header file on
                      > comp.std.c++, but received no reply.[/color]

                      People here and in comp.std.c++ volunteer their free time to participate
                      in discussions they find interesting. If you don't get an answer to your
                      posts, it's either because a) there's a great conspiracy against you or
                      b) your question was not regarded as something worth spending time on.

                      Now, which of the two alternatives do you think is the more likely one?

                      //JD

                      Comment

                      • Steven T. Hatton

                        #12
                        Re: What is a header?

                        John Doe wrote:
                        [color=blue]
                        > On Thu, 01 Apr 2004 17:10:38 -0500, Steven T. Hatton wrote:
                        >[color=green]
                        >>
                        >> I have the feeling there is some ancient dark secret surrounding this
                        >> issue that none of the oldtimers wants to talk about. I tried to ask
                        >> about the history of research into alternatives to the traditional header
                        >> file on comp.std.c++, but received no reply.[/color]
                        >
                        > People here and in comp.std.c++ volunteer their free time to participate
                        > in discussions they find interesting. If you don't get an answer to your
                        > posts, it's either because a) there's a great conspiracy against you or
                        > b) your question was not regarded as something worth spending time on.
                        >
                        > Now, which of the two alternatives do you think is the more likely one?
                        >
                        > //JD[/color]

                        Actually there's more to it than just posting the question once. But, like I
                        said, it's just a feeling.
                        --
                        p->m == (*p).m == p[0].m

                        Modernize your infrastructure with SUSE Linux Enterprise servers, cloud technology for IaaS, and SUSE's software-defined...

                        Mozilla is the not-for-profit behind the lightning fast Firefox browser. We put people over profit to give everyone more power online.

                        Comment

                        • Leor Zolman

                          #13
                          Re: What is a header?

                          On Thu, 01 Apr 2004 14:01:53 -0800, Julie <julie@nospam.c om> wrote:
                          [color=blue]
                          >"Steven T. Hatton" wrote:[color=green]
                          >>
                          >> Julie wrote:
                          >>[color=darkred]
                          >> > "Steven T. Hatton" wrote:
                          >> >>
                          >> >> If a header is not necessarily a source file, and the sequences delimited
                          >> >> by < and > in header names aren't necessarily valid source file names,
                          >> >> what exactly is a header?
                          >> >
                          >> > A header is _necessarily_ a source file that is exclusively distinctly
                          >> > visible by the preprocessor.[/color]
                          >> "A header is not necessarily a source file, nor are the sequences delimited
                          >> by < and > in header names necessarily valid source file names (16.2)."
                          >> ISO/IEC 14882:2003(E)[/color]
                          >
                          >I would have preferred you posting that with your original post.[/color]

                          The OP doesn't seem to believe in providing more information than it takes
                          in order for him to be able to understand his own questions. Or, he just
                          phrases questions in a way that misrepresents the level he's approaching
                          the issue from; whether he's doing this to deliberately draw folks who are
                          earnestly trying to help him into making errors he can "poach", or he just
                          takes opportunities when they arise to demonstrate what he possibly thinks
                          of as his superior intellect, I can't say. I do, however, now find myself
                          embarrassed to be seen in the same thread with him (I would have preferred
                          to email this to you directly, but you don't give out your address.)
                          -leor

                          --
                          Leor Zolman --- BD Software --- www.bdsoft.com
                          On-Site Training in C/C++, Java, Perl and Unix
                          C++ users: Download BD Software's free STL Error Message Decryptor at:
                          An STL Error Decryptor for C++ by Leor Zolman of BD Software - available to download here

                          Comment

                          • Steven T. Hatton

                            #14
                            Re: What is a header?

                            Leor Zolman wrote:

                            [color=blue]
                            >
                            > The OP doesn't seem to believe in providing more information than it takes
                            > in order for him to be able to understand his own questions. Or, he just
                            > phrases questions in a way that misrepresents the level he's approaching
                            > the issue from;[/color]

                            Hu?
                            [color=blue]
                            > whether he's doing this to deliberately draw folks who are
                            > earnestly trying to help him into making errors he can "poach",[/color]

                            Na, I only take fair game.

                            --
                            p->m == (*p).m == p[0].m

                            Modernize your infrastructure with SUSE Linux Enterprise servers, cloud technology for IaaS, and SUSE's software-defined...

                            Mozilla is the not-for-profit behind the lightning fast Firefox browser. We put people over profit to give everyone more power online.

                            Comment

                            • Frosted Flake

                              #15
                              Re: What is a header?

                              > The OP doesn't seem to believe in providing more information than it takes[color=blue]
                              > in order for him to be able to understand his own questions. Or, he just
                              > phrases questions in a way that misrepresents the level he's approaching
                              > the issue from; whether he's doing this to deliberately draw folks who are
                              > earnestly trying to help him into making errors he can "poach", or he just
                              > takes opportunities when they arise to demonstrate what he possibly thinks
                              > of as his superior intellect, I can't say. I do, however, now find myself
                              > embarrassed to be seen in the same thread with him (I would have preferred
                              > to email this to you directly, but you don't give out your address.)
                              > -leor[/color]

                              It might be useful to layout what was said.

                              Mr Hatton's first post:
                              If a header is not necessarily a source file, and the sequences delimited by
                              < and > in header names aren't necessarily valid source file names, what
                              exactly is a header?

                              2nd: (Note the same wording as above)
                              "A header is not necessarily a source file, nor are the sequences delimited
                              by < and > in header names necessarily valid source file names (16.2)."
                              ISO/IEC 14882:2003(E)

                              3rd:
                              I have the feeling there is some ancient dark secret surrounding this issue
                              that none of the oldtimers wants to talk about. I tried to ask about the
                              history of research into alternatives to the traditional header file on
                              comp.std.c++, but received no reply.

                              4th:
                              There's an interesting epigraph at the beginning of chapter 18 in
                              TC++PL(SE). Form is liberating. - engineers' proverb.

                              5th:
                              Actually there's more to it than just posting the question once. But, like I
                              said, it's just a feeling.



                              Comment

                              Working...