Re: Headers!

From: Greg Comeau (comeau_at_panix.com)
Date: 03/05/04


Date: 5 Mar 2004 10:36:34 -0500

In article <jyZ1c.5885$%x4.732731@news.siol.net>,
Atmapuri <janez.makovsek@usa.net> wrote:
>I looked through the web and different C tutorials, but could not find
>anywhere an explanation of what are .h files and how to write them.
>Everybody explaines how to use them, but there are no references to
>why and how... Could anybody help at least with a link?

Other hand no doubt responded to this already, so I'll add
that you should consider getting a copy of Stroustrup's
3rd edition (or special edition) and check out Chapter 9.

>Another thing:
>
>Why this:
>
>#ifdef __cplusplus
>extern "C"
>{
>#endif

Because that author appears to be intending to support co-ed header
files, that is, header files that can be accepted by both C and C++.

>And is there any point in giving my file a .c extension or should I just
>make it .cpp. I will not use objects.

Depends upon your compiler.

-- 
Greg Comeau / Comeau C++ 4.3.3, for C++03 core language support
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout
World Class Compilers:  Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?


Relevant Pages

  • Re: writing to a string
    ... If you mean file sorting then you'd be using ... >guranteed to work on any platfrom in existence then you are no longer just ... World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. ... Comeau C/C++ with Dinkumware's Libraries... ...
    (alt.comp.lang.learn.c-cpp)
  • Re: <ctype.h> toLower()
    ... >> Assigning anything to a constant string literal brings up undefined ... >> int main ... World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. ... Comeau C/C++ with Dinkumware's Libraries... ...
    (alt.comp.lang.learn.c-cpp)
  • Re: fstream
    ... >|>int main ... >| I forget the exact dis/allowances here, but I'd just like to point ... World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. ... Comeau C/C++ with Dinkumware's Libraries... ...
    (alt.comp.lang.learn.c-cpp)
  • Re: [9fans] "Blocks" in C
    ... function pointers. ... scoping rules or something in that other language. ... World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. ... Comeau C/C++ with Dinkumware's Libraries... ...
    (comp.os.plan9)
  • Re: Port code from C++ to C?
    ... which use most C++ comman features. ... I don't have to change the C++ code structures. ... World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. ... Comeau C/C++ with Dinkumware's Libraries. ...
    (comp.lang.c)