Topic: Standard mentions "header files" !


Author: kprateek88@yahoo.com (Prateek R Karandikar)
Date: Wed, 30 Jun 2004 19:00:49 +0000 (UTC)
Raw View
> Regarding the OPs point,
> I suppose that "header file" is just an informal term for "source file
> intended to be included in other source files using the #include
> directive". But perhaps it should have been defined.
>
> Tom

IMHO the Standard shouldn't be using informal terms. Many posters are
confused about headers and header files. They usually refer to
<vector>, <iostream>, etc as header files. If the Standard defines the
term, it will further complicate the issue. At the moment, you can
#include headers, and you can #include source files. Why would we need
to define "header file"?

--                                    --
Abstraction is selective ignorance.
-Andrew Koenig
--                                    --

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: kprateek88@yahoo.com (Prateek R Karandikar)
Date: Mon, 28 Jun 2004 04:46:13 +0000 (UTC)
Raw View
I am under the impression that the Standard had no concept of "header
file". Just to be sure, I did a text search. "header file" occurs
twice (both in informative sections), both times in Annex C.

C.1.2 Clause 3: basic concepts
3.5
"... This feature allows the user to put const objects in *header
files* that are included in many compilation units ..."

C.1.2 Clause 3: basic concepts
8.3.5
"...The type definitions must be moved to file scope, or in *header
files*..."

(Emphasis mine)

Maybe "header file" should be changed to "source file intended to be
included in other source files using the #include directive". I know
this is only in the informative section, but nevertheless...

Any comments?

--                                    --
Abstraction is selective ignorance.
-Andrew Koenig
--                                    --

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: tom_usenet@hotmail.com (tom_usenet)
Date: Mon, 28 Jun 2004 18:49:43 +0000 (UTC)
Raw View
On Mon, 28 Jun 2004 04:46:13 +0000 (UTC), kprateek88@yahoo.com
(Prateek R Karandikar) wrote:

>I am under the impression that the Standard had no concept of "header
>file". Just to be sure, I did a text search. "header file" occurs
>twice (both in informative sections), both times in Annex C.
>
>C.1.2 Clause 3: basic concepts
>3.5
>"... This feature allows the user to put const objects in *header
>files* that are included in many compilation units ..."
>
>C.1.2 Clause 3: basic concepts
>8.3.5
>"...The type definitions must be moved to file scope, or in *header
>files*..."
>
>(Emphasis mine)
>
>Maybe "header file" should be changed to "source file intended to be
>included in other source files using the #include directive". I know
>this is only in the informative section, but nevertheless...
>
>Any comments?

"header" is used all over the place. "header names" are defined in
2.8. "header file" is just a mildly dodgy synonym for "header".

Tom
--
C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: francis@robinton.demon.co.uk (Francis Glassborow)
Date: Tue, 29 Jun 2004 04:49:57 +0000 (UTC)
Raw View
In article <arsvd019s6hthqsqdoe861daq94c619smu@4ax.com>, tom_usenet
<tom_usenet@hotmail.com> writes
>"header" is used all over the place. "header names" are defined in
>2.8. "header file" is just a mildly dodgy synonym for "header".

No it is not. A header is the term applied to the mechanism by which a
specific group of declarations from the Standard C++ Library is made
visible in user source code. That mechanism is usually a source code
file but the Standard makes no requirement that that be the way it is
implemented (for example, a compiler can have all those declarations
built-in to it and they become visible when the compiler 'sees' the
relevant #include). The term header file is applied to a source code
file that is intended to limit its contents to things that will not
break the ODR if it is included in more than one TU.

I have always understood this to mean that:

#include <vector>
and
#include "vector.h"

Are different in more ways than is commonly understood. The first allows
a compiler to 'magically' know what is in the header, the second
requires that it textually include the actual contents of vector.h.


--
Francis Glassborow      ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: tom_usenet <tom_usenet@hotmail.com>
Date: 29 Jun 2004 21:45:08 GMT
Raw View
On Tue, 29 Jun 2004 04:49:57 +0000 (UTC), francis@robinton.demon.co.uk
(Francis Glassborow) wrote:

>In article <arsvd019s6hthqsqdoe861daq94c619smu@4ax.com>, tom_usenet
><tom_usenet@hotmail.com> writes
>>"header" is used all over the place. "header names" are defined in
>>2.8. "header file" is just a mildly dodgy synonym for "header".
>
>No it is not. A header is the term applied to the mechanism by which a
>specific group of declarations from the Standard C++ Library is made
>visible in user source code. That mechanism is usually a source code
>file but the Standard makes no requirement that that be the way it is
>implemented (for example, a compiler can have all those declarations
>built-in to it and they become visible when the compiler 'sees' the
>relevant #include). The term header file is applied to a source code
>file that is intended to limit its contents to things that will not
>break the ODR if it is included in more than one TU.
>
>I have always understood this to mean that:
>
>#include <vector>
>and
>#include "vector.h"
>
>Are different in more ways than is commonly understood. The first allows
>a compiler to 'magically' know what is in the header, the second
>requires that it textually include the actual contents of vector.h.

Ahh, agreed after reading the relevant sections, although surprisingly
#include "vector"
also seems to be allowed according to 16.2/3. Regarding the OPs point,
I suppose that "header file" is just an informal term for "source file
intended to be included in other source files using the #include
directive". But perhaps it should have been defined.

Tom
--
C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]