.h for standard headers

Discussion in 'C++' started by Christopher Benson-Manica, May 18, 2004.

  1. At what point was the .h dropped from the STL headers? I just had a
    discussion yesterday with my boss, who said he wanted .h on all the
    STL includes, despite me protesting that it was not standard...

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
     
    Christopher Benson-Manica, May 18, 2004
    #1
    1. Advertising

  2. Christopher Benson-Manica

    Tim Love Guest

    Christopher Benson-Manica <> writes:

    >At what point was the .h dropped from the STL headers?

    When ANSI C++ arrived, I think. When the STL was subsumed into the SL.
     
    Tim Love, May 18, 2004
    #2
    1. Advertising

  3. Christopher Benson-Manica wrote:
    >
    > At what point was the .h dropped from the STL headers? I just had a
    > discussion yesterday with my boss, who said he wanted .h on all the
    > STL includes, despite me protesting that it was not standard...
    >


    In standard C++: Never
    That is: .h was never a part of the standard includes.
    All usages of eg. iostream.h date back to an era, where
    'Standard C++' as defined today was nothing more then an
    entry in a ToDo list. Some compiler vendors kept them
    for compatibility even when 'The Standard' came into
    existence.

    --
    Karl Heinz Buchegger
     
    Karl Heinz Buchegger, May 18, 2004
    #3
  4. Karl Heinz Buchegger <> spoke thus:

    > In standard C++: Never
    > That is: .h was never a part of the standard includes.
    > All usages of eg. iostream.h date back to an era, where
    > 'Standard C++' as defined today was nothing more then an
    > entry in a ToDo list. Some compiler vendors kept them
    > for compatibility even when 'The Standard' came into
    > existence.


    Did that era include, say, 1999?

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
     
    Christopher Benson-Manica, May 18, 2004
    #4
  5. Christopher Benson-Manica

    Sharad Kala Guest

    "Christopher Benson-Manica" <> wrote in message
    news:c8d422$s69$...
    > Karl Heinz Buchegger <> spoke thus:
    >
    > Did that era include, say, 1999?


    The standard was ratified in 1997 and became official in1998.
     
    Sharad Kala, May 18, 2004
    #5
  6. Christopher Benson-Manica wrote:
    >
    > Karl Heinz Buchegger <> spoke thus:
    >
    > > In standard C++: Never
    > > That is: .h was never a part of the standard includes.
    > > All usages of eg. iostream.h date back to an era, where
    > > 'Standard C++' as defined today was nothing more then an
    > > entry in a ToDo list. Some compiler vendors kept them
    > > for compatibility even when 'The Standard' came into
    > > existence.

    >
    > Did that era include, say, 1999?


    If I recall correctly, the first version of the Standard
    was published 1998

    --
    Karl Heinz Buchegger
     
    Karl Heinz Buchegger, May 18, 2004
    #6
  7. "Christopher Benson-Manica" <> wrote in message
    news:c8d422$s69$...
    > Karl Heinz Buchegger <> spoke thus:
    >
    > > In standard C++: Never
    > > That is: .h was never a part of the standard includes.
    > > All usages of eg. iostream.h date back to an era, where
    > > 'Standard C++' as defined today was nothing more then an
    > > entry in a ToDo list. Some compiler vendors kept them
    > > for compatibility even when 'The Standard' came into
    > > existence.

    >
    > Did that era include, say, 1999?


    No, C++ was standardized in 1998. Adding .h to the standard header files
    may mean that some day your code will no longer compile when you
    change/upgrade your compiler and/or the standard library implementation.
    That may very well be the motivation for your boss to insist on adding .h
    to standard headers.
    --
    Peter van Merkerk
    peter.van.merkerk(at)dse.nl
     
    Peter van Merkerk, May 18, 2004
    #7
  8. Christopher Benson-Manica

    John Carson Guest

    "Peter van Merkerk" <> wrote in message
    news:
    >
    > No, C++ was standardized in 1998. Adding .h to the standard header
    > files may mean that some day your code will no longer compile when you
    > change/upgrade your compiler and/or the standard library
    > implementation.


    That day is already here as far as VC++ 2003 is concerned.


    --
    John Carson
    1. To reply to email address, remove donald
    2. Don't reply to email address (post here instead)
     
    John Carson, May 18, 2004
    #8
  9. Christopher Benson-Manica

    Howard Guest

    "Christopher Benson-Manica" <> wrote in message
    news:c8d33k$rsl$...
    > At what point was the .h dropped from the STL headers? I just had a
    > discussion yesterday with my boss, who said he wanted .h on all the
    > STL includes, despite me protesting that it was not standard...
    >
    > --


    That's just silly. It's not a matter of style, or "common practice". It's
    that the names of the files have changed. Some compilers still provide
    headers with .h file extensions in their names, which (I believe) simply
    include the non-.h version, but that's not required, and is likely to go
    away entirely. And even now, if you want to include the file cstring, how
    exactly is including cstring.h supposed to work when there is no such
    file???

    -Howard
     
    Howard, May 18, 2004
    #9
  10. Christopher Benson-Manica

    John Ericson Guest

    "Christopher Benson-Manica" <>
    wrote in message news:c8d422$s69$...
    > Karl Heinz Buchegger <> spoke thus:
    >
    > > In standard C++: Never
    > > That is: .h was never a part of the standard includes.
    > > All usages of eg. iostream.h date back to an era, where
    > > 'Standard C++' as defined today was nothing more then an
    > > entry in a ToDo list. Some compiler vendors kept them
    > > for compatibility even when 'The Standard' came into
    > > existence.

    >
    > Did that era include, say, 1999?
    >
    > --
    > Christopher Benson-Manica | I *should* know what I'm

    talking about - if I
    > ataru(at)cyberspace.org | don't, I need to know.

    Flames welcome.

    If you have legacy code using pre-Standard headers, it may
    _require_ those pre-standard headers. I ran into that with
    code that compiled with a particular <iostream.h>, but not
    with <iostream>. God knows what happens if you mix headers,
    but it sure wouldn't be anything good.
    - -
    JE
     
    John Ericson, May 18, 2004
    #10
  11. Christopher Benson-Manica

    Rolf Magnus Guest

    Peter van Merkerk wrote:

    >> Did that era include, say, 1999?

    >
    > No, C++ was standardized in 1998. Adding .h to the standard header
    > files may mean that some day your code will no longer compile when you
    > change/upgrade your compiler and/or the standard library
    > implementation. That may very well be the motivation for your boss to
    > insist on adding .h to standard headers.


    I don't quite understand that statement. Why would the boss _want_ to
    make sure that his programmers write code that will stop compiling on
    modern compilers?
     
    Rolf Magnus, May 18, 2004
    #11
  12. Christopher Benson-Manica

    Tim Clacy Guest

    Christopher Benson-Manica wrote:
    > At what point was the .h dropped from the STL headers? I just had a
    > discussion yesterday with my boss, who said he wanted .h on all the
    > STL includes, despite me protesting that it was not standard...


    Presumably the idea of omitting an extension was thought up by someone who
    doesn't use Windows; we have lost the conveniences of double clicking to
    open and meaningful icon associations in one fell swoop.
     
    Tim Clacy, May 18, 2004
    #12
  13. Christopher Benson-Manica

    Julie Guest

    Christopher Benson-Manica wrote:
    >
    > At what point was the .h dropped from the STL headers? I just had a
    > discussion yesterday with my boss, who said he wanted .h on all the
    > STL includes, despite me protesting that it was not standard...


    1997/1998.

    The compelling reason was that there wasn't a consensus on the appropriate C++
    header extension (.h, .hpp, .hxx, ...), so it was agreed (not unanimously) to
    drop the extension altogether.
     
    Julie, May 18, 2004
    #13
  14. Christopher Benson-Manica

    Jeff Schwab Guest

    Tim Clacy wrote:
    > Christopher Benson-Manica wrote:
    >
    >>At what point was the .h dropped from the STL headers? I just had a
    >>discussion yesterday with my boss, who said he wanted .h on all the
    >>STL includes, despite me protesting that it was not standard...

    >
    >
    > Presumably the idea of omitting an extension was thought up by someone who
    > doesn't use Windows; we have lost the conveniences of double clicking to
    > open and meaningful icon associations in one fell swoop.


    Yeah, I'm crying my little heart out.

    The new headers, unlike the old, place standard library constructs in
    namespace std. Lots of legacy code already existed using the .h headers
    and no namespace std. Having different names for the new (std-based)
    headers allowed implementers to provide headers complying with the new
    standard, without breaking the legacy code. For users of
    implementations not providing the new headers, an easy work-around was
    available:

    // <iostream>

    namespace std
    {
    #include <iostream.h>
    }
     
    Jeff Schwab, May 18, 2004
    #14
  15. Christopher Benson-Manica

    Tim Clacy Guest

    Jeff Schwab wrote:
    > Tim Clacy wrote:
    >> Christopher Benson-Manica wrote:
    >>
    >>> At what point was the .h dropped from the STL headers? I just had a
    >>> discussion yesterday with my boss, who said he wanted .h on all the
    >>> STL includes, despite me protesting that it was not standard...

    >>
    >>
    >> Presumably the idea of omitting an extension was thought up by
    >> someone who doesn't use Windows; we have lost the conveniences of
    >> double clicking to open and meaningful icon associations in one fell
    >> swoop.

    >
    > Yeah, I'm crying my little heart out.


    ...but seriously though, unless you're a hardened character-mode console
    bashing hack, it is a pain not being able to easily identify or open header
    files.

    > The new headers, unlike the old, place standard library constructs in
    > namespace std. Lots of legacy code already existed using the .h
    > headers and no namespace std. Having different names for the new
    > (std-based) headers allowed implementers to provide headers complying
    > with the new standard, without breaking the legacy code. For users of
    > implementations not providing the new headers, an easy work-around was
    > available:
    >
    > // <iostream>
    >
    > namespace std
    > {
    > #include <iostream.h>
    > }
     
    Tim Clacy, May 18, 2004
    #15
  16. Christopher Benson-Manica

    Rolf Magnus Guest

    Jeff Schwab wrote:

    > The new headers, unlike the old, place standard library constructs in
    > namespace std. Lots of legacy code already existed using the .h
    > headers and no namespace std. Having different names for the new
    > (std-based) headers allowed implementers to provide headers complying
    > with the new standard, without breaking the legacy code.


    Which btw. brings up another point. The classes in the .h headers might
    not be exactly the same as in the non-.h headers. So you might
    experience surprises if you use the .h ones.
     
    Rolf Magnus, May 18, 2004
    #16
  17. Christopher Benson-Manica

    Stephen Howe Guest

    "Christopher Benson-Manica" <> wrote in message
    news:c8d33k$rsl$...
    > At what point was the .h dropped from the STL headers? I just had a
    > discussion yesterday with my boss, who said he wanted .h on all the
    > STL includes, despite me protesting that it was not standard...


    Your boss needs re-educating.
    Your boss should changes his views so that, "Whatever is standard C++, is
    the company standard". That view will last a long time.

    Stephen Howe
     
    Stephen Howe, May 18, 2004
    #17
  18. Christopher Benson-Manica

    Jeff Schwab Guest

    Tim Clacy wrote:
    > Jeff Schwab wrote:
    >
    >>Tim Clacy wrote:
    >>
    >>>Christopher Benson-Manica wrote:
    >>>
    >>>
    >>>>At what point was the .h dropped from the STL headers? I just had a
    >>>>discussion yesterday with my boss, who said he wanted .h on all the
    >>>>STL includes, despite me protesting that it was not standard...
    >>>
    >>>
    >>>Presumably the idea of omitting an extension was thought up by
    >>>someone who doesn't use Windows; we have lost the conveniences of
    >>>double clicking to open and meaningful icon associations in one fell
    >>>swoop.

    >>
    >>Yeah, I'm crying my little heart out.

    >
    >
    > ..but seriously though, unless you're a hardened character-mode console
    > bashing hack, it is a pain not being able to easily identify or open header
    > files.


    Well, I am pretty much a console-oriented kinda guy. However, I'm not
    sure how relevant that is. I know what type of files are stored in
    directories called "include", and my preferred editors can recognize
    file-types based on names matching arbitrary patterns, not just the file
    names' extensions.
     
    Jeff Schwab, May 18, 2004
    #18
  19. Christopher Benson-Manica

    P.J. Plauger Guest

    "David Fisher" <> wrote in message
    news:dkqqc.850$...

    > Christopher Benson-Manica asked:
    >
    > > At what point was the .h dropped from the STL headers? I just had a
    > > discussion yesterday with my boss, who said he wanted .h on all the
    > > STL includes, despite me protesting that it was not standard...

    >
    > You may have a problem with <string.h> (should it be the one containing
    > strcpy() or the std::string class ?)
    >
    > According to Chuck Alison in the article "What's New in Standard C++"
    > (http://www.freshsources.com/newcpp.html), old style library headers are
    > deprecated ... here is the relevant quote:
    >
    > Invoking Standard C Headers with a .h suffix
    > --------------------------------------------
    >
    > We traditionally think of headers as files, but a compiler is free to make

    a
    > header's declarations available in any manner it chooses. To encourage

    this
    > point of view, the C++ standards committee voted rather early to drop the

    ..h
    > suffix for C++ headers. This means that you should use "#include <
    > iostream>" instead of "#include <iostream.h>", although most compilers

    will
    > allow both. When namespaces were added to the language, the committee
    > decided to wrap most C++ and all standard C library declarations in the
    > standard namespace std, and to rename the C headers by prepending a 'c'

    and
    > dropping the .h suffix. This means that the preferred method of getting at

    C
    > library features is the same for using C++ library elements, for example
    > #include <cstdio>
    >
    > int main()
    > {
    > std::printf("hello, world\n");
    > }
    >
    > Thinking that this might be too much of a culture shock, the committee
    > decided to deprecate instead of to disallow altogether the traditional

    ".h"
    > method. For now, if you say "#include <stdio.h>", it's as if you had

    written
    > "#include <cstdio>" followed by a using declaration for each identifier
    > defined in the header (so you don't have to use the std:: prefix).


    True in theory, not always in practice.

    P.J. Plauger
    Dinkumware, Ltd.
    http://www.dinkumware.com
     
    P.J. Plauger, May 18, 2004
    #19
  20. Stephen Howe <stephenPOINThoweATtns-globalPOINTcom> spoke thus:

    > Your boss needs re-educating.
    > Your boss should changes his views so that, "Whatever is standard C++, is
    > the company standard". That view will last a long time.


    That's unlikely - I got chewed out yesterday because I changed a
    global character array to a global string, and I've been all but
    forbidden to use vectors, maps, and sets, not to mention strings. I
    can't use streams at all because they don't work correctly, and I
    can't count on other things working because our implementation is two
    versions out of date. Yes, I've decided to find myself another job,
    if I can :)

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
     
    Christopher Benson-Manica, May 18, 2004
    #20
    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. Replies:
    8
    Views:
    426
    E. Robert Tisdale
    Oct 14, 2004
  2. dont bother
    Replies:
    0
    Views:
    866
    dont bother
    Mar 3, 2004
  3. Simon Elliott

    namespace std and standard headers

    Simon Elliott, Oct 11, 2005, in forum: C++
    Replies:
    16
    Views:
    577
    Simon Elliott
    Oct 13, 2005
  4. Phil
    Replies:
    4
    Views:
    732
    Gabriel Genellina
    Jan 17, 2010
  5. Ian
    Replies:
    2
    Views:
    2,104
Loading...

Share This Page