difference in header files

Discussion in 'C Programming' started by Pradyut, Aug 9, 2005.

  1. Pradyut

    Pradyut Guest

    Pradyut, Aug 9, 2005
    #1
    1. Advertising

  2. In article <42f90942$0$15875$>,
    Pradyut <> wrote:
    >what's the difference between a .h and a .hpp file


    C doesn't promise that a .hpp file can be #include'd -- unique
    mappings are promised only for (up to) 6-characters followed by a
    single character.

    >Also please tell me something about .rh files


    As per above, C doesn't promise that .rh files are usable either.


    Perhaps you are thinking of some other programming language, such
    as C++?
    --
    Ceci, ce n'est pas une idée.
    Walter Roberson, Aug 9, 2005
    #2
    1. Advertising

  3. Pradyut

    Kulka Guest

    Pieknego dnia Wed, 10 Aug 2005 01:22:17 +0530,
    osobnik Pradyut napisa³(a):

    > what's the difference between a .h and a .hpp file

    ..hpp are header files for c++, while h for c

    --
    \x6b\x75\x6c\x6b\x61
    Kulka, Aug 9, 2005
    #3
  4. Pradyut wrote:

    > what's the difference between a *.h and a *.hpp file


    These file extensions are arbitrary but customary.
    You can include files with *any* file name extension or none at all.

    > Also please tell me something about .rh files


    Which is what appears to have been done here.

    The *.h extension was added to [UNIX] file names
    to suggest that the file was a C *header* file
    instead of a C *source* file.
    The *.hpp file name extension is sometimes used
    to distinguish C++ header files from C header files.

    A header file is a file that is included near the top (head)
    of a translation unit (source file) or another header file.
    It may contain *any* valid C code
    but header files are commonly used
    to introduce a module interface into a translation unit.
    The module interface contains C preprocessor macro definitions,
    type definitions, constant definitions,
    function and variable declarations
    that do not by themselves require the compiler to emit code
    or reserve space for objects.
    E. Robert Tisdale, Aug 9, 2005
    #4
  5. On Wed, 10 Aug 2005 01:22:17 +0530, in comp.lang.c , "Pradyut"
    <> wrote:

    >what's the difference between a .h and a .hpp file


    this would be something specific to your implementation or company
    style. C doesn't place any particular requirements on the file
    extensions - remember that its only MSDOS and its children that think
    the extension is an indication of the file's format, most other OSen
    find it more useful to store that info elsewhere...

    <ot>
    some people like to use hpp for C++ includes and h for C ones.
    </ot>

    >Also please tell me something about .rh files


    Something else system-specific. Possibly resource includes? Ask in a
    newsgroup specialising in your compiler.
    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
    Mark McIntyre, Aug 9, 2005
    #5
  6. In article <ddb597$att$>,
    E. Robert Tisdale <> wrote:
    >These file extensions are arbitrary but customary.
    >You can include files with *any* file name extension or none at all.


    C89 doesn't promise that it will be able to uniquely locate files
    whose extension is more than 1 character long. (C89 doesn't want to
    impose any filesystem semantics onto freestanding implementations.)
    --
    This signature intentionally left... Oh, darn!
    Walter Roberson, Aug 9, 2005
    #6
  7. Walter Roberson wrote:
    > In article <ddb597$att$>,
    > E. Robert Tisdale <> wrote:
    > >These file extensions are arbitrary but customary.
    > >You can include files with *any* file name extension or none at all.

    >
    > C89 doesn't promise that it will be able to uniquely locate files
    > whose extension is more than 1 character long.


    Yup, the same stands for C99 as well. Not only that, the 1 character
    must be a *letter* to qualify for this this guarantee. Additionally,
    since the implementation may ignore the case of filenames in #include
    directives, it need not differentiate between header.h and header.H (or
    HEADER.H for that matter).

    Robert Gamble
    Robert Gamble, Aug 10, 2005
    #7
  8. Pradyut

    Jack Klein Guest

    On Tue, 9 Aug 2005 19:58:39 +0000 (UTC), -cnrc.gc.ca
    (Walter Roberson) wrote in comp.lang.c:

    > In article <42f90942$0$15875$>,
    > Pradyut <> wrote:
    > >what's the difference between a .h and a .hpp file

    >
    > C doesn't promise that a .hpp file can be #include'd -- unique
    > mappings are promised only for (up to) 6-characters followed by a
    > single character.


    Note that this is, and has been since 1999:

    "The implementation shall provide unique mappings for sequences
    consisting of one or more letters or digits (as defined in 5.2.1)
    followed by a period (.) and a single letter. The first character
    shall be a letter. The implementation may ignore the distinctions of
    alphabetical case and restrict the mapping to eight significant
    characters before the period."

    So it now 8 characters, and the standard now includes three standard
    headers that have more than six significant characters before the
    period: <complex.h>, <stdbool.h>, and <inttypes.h>

    Other than the standard headers, C places no restrictions at all on
    the contents of <h_char_sequence> or "q_char_sequence" in a #include
    directive. If between them the implementation and underlying platform
    map them into a file "that can be processed by the application", it
    causes the replacement of the directive by the entire contents of the
    file.

    If the sequence does not match a standard header and does not map to
    the name of a file that can be processed by the application, it is a
    constraint error and a diagnostic is required.

    > >Also please tell me something about .rh files

    >
    > As per above, C doesn't promise that .rh files are usable either.
    >
    >
    > Perhaps you are thinking of some other programming language, such
    > as C++?


    I don't really see what C++ has to do with it.

    Even under MS-DOS, in fact even under CP/M 80, I could expect:

    #include "filename.rh"

    ....to do what I wanted, assuming there was a file named filename.rh in
    the implementation-defined search path. Although AFAIK there was
    never a C90 conforming implementation for CP/M 80.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
    Jack Klein, Aug 10, 2005
    #8
  9. Pradyut

    Jack Klein Guest

    On Tue, 9 Aug 2005 21:59:32 +0000 (UTC), -cnrc.gc.ca
    (Walter Roberson) wrote in comp.lang.c:

    > In article <ddb597$att$>,
    > E. Robert Tisdale <> wrote:
    > >These file extensions are arbitrary but customary.
    > >You can include files with *any* file name extension or none at all.

    >
    > C89 doesn't promise that it will be able to uniquely locate files
    > whose extension is more than 1 character long. (C89 doesn't want to
    > impose any filesystem semantics onto freestanding implementations.)


    Where does C89, or any other version, mention an implementation that
    runs (as opposed to builds code for) a free-standing environment?

    No environment for translators is mentioned at all. The distinction
    between hosted and free-standing environments has to do with
    execution, not translation.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
    Jack Klein, Aug 10, 2005
    #9
  10. On Tue, 09 Aug 2005 21:47:33 -0500, Jack Klein wrote:

    > On Tue, 9 Aug 2005 21:59:32 +0000 (UTC), -cnrc.gc.ca
    > (Walter Roberson) wrote in comp.lang.c:
    >
    >> In article <ddb597$att$>,
    >> E. Robert Tisdale <> wrote:
    >> >These file extensions are arbitrary but customary.
    >> >You can include files with *any* file name extension or none at all.

    >>
    >> C89 doesn't promise that it will be able to uniquely locate files
    >> whose extension is more than 1 character long. (C89 doesn't want to
    >> impose any filesystem semantics onto freestanding implementations.)

    >
    > Where does C89, or any other version, mention an implementation that
    > runs (as opposed to builds code for) a free-standing environment?
    >
    > No environment for translators is mentioned at all. The distinction
    > between hosted and free-standing environments has to do with
    > execution, not translation.


    The standard sepcifies hosted and freestanding implementations as well as
    execution environments. This is highly relevant to translation, for
    example #include <stdio.h> may legitimately fail during translation on a
    freestanding implementation.

    Lawrence
    Lawrence Kirby, Aug 10, 2005
    #10
  11. <posted & mailed>

    A ".h file" is a file using a common convention for naming header files for
    C libraries. As far as the C language is concerned, there's no such thing
    as a .hpp or .rh file.

    Pradyut wrote:

    > what's the difference between a .h and a .hpp file
    > Also please tell me something about .rh files
    >
    >


    --
    Remove '.nospam' from e-mail address to reply by e-mail
    James McIninch, Aug 10, 2005
    #11
  12. On Tue, 09 Aug 2005 22:57:46 +0100, Mark McIntyre
    <> wrote:

    > On Wed, 10 Aug 2005 01:22:17 +0530, in comp.lang.c , "Pradyut"
    > <> wrote:
    >
    > >what's the difference between a .h and a .hpp file

    >
    > this would be something specific to your implementation or company
    > style. C doesn't place any particular requirements on the file
    > extensions - remember that its only MSDOS and its children that think
    > the extension is an indication of the file's format, most other OSen
    > find it more useful to store that info elsewhere...
    >

    I know no OS that itself relies on the extension, except in a CI/shell
    that can be overridden or at least adjusted to some extent. But there
    certainly have been many before and other than MS that supported an
    extension or equivalent field that most or all vendor-supplied utility
    software _did_ rely on: at least RT-11, RSX-11, TOPS-10 and -20 -- and
    (nonvendor) ITS to some extent, VMS, I think AOS/VS, and VM/CMS. And
    CP/M, which is no child of MSDOS although a case can be made for the
    inverse. Even in Unix _some_ utility software relies on extensions.

    - David.Thompson1 at worldnet.att.net
    Dave Thompson, Aug 14, 2005
    #12
    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. John Smith

    Header files included in header files

    John Smith, Jul 21, 2004, in forum: C Programming
    Replies:
    18
    Views:
    585
    Jack Klein
    Jul 24, 2004
  2. Replies:
    3
    Views:
    1,269
    Walter Roberson
    May 1, 2006
  3. nrhayyal
    Replies:
    8
    Views:
    513
    Jack Klein
    Nov 19, 2005
  4. Mark Sullivan
    Replies:
    27
    Views:
    4,769
    James Kanze
    May 21, 2008
  5. mlt
    Replies:
    2
    Views:
    805
    Jean-Marc Bourguet
    Jan 31, 2009
Loading...

Share This Page