Re: struct question

From: pete (pfiland_at_mindspring.com)
Date: 08/06/04


Date: Fri, 06 Aug 2004 10:58:29 GMT

CBFalconer wrote:
>
> pete wrote:
> >
> ... snip ...
> >
> > For matched pairs of .c and .h files:
> > I am inclined not to put extern object declarations in a header.

> You won't go wrong if you consider the .h file as a means of
> publicizing those portions of the .c file you want to make
> accessible to other compilation units. Thus you declare and
> define the objects in the .c file. If the objects are NOT to be
> accessible externally you mark them static. If they ARE to be
> accessible externally you declare them in the .h file, and use the
> extern keyword for objects other than function prototypes.

The more I think about what you wrote, the more I like it.

-- 
pete


Relevant Pages

  • Re: DECLARE and DLLs
    ... stick a dummy PRG in the project with FUNCTION headers for the functions you're using. ... Just for yuks, I also tried EXTERN, DECLARE, CALL ... Meanwhile the examples in the manual involved using this command to declare or otherwise use things that were going to be called via macro or name substitution. ... Unknown ISEDLOADFROMFILE - Undefined ...
    (microsoft.public.fox.programmer.exchange)
  • Re: extern for global variable: C Question
    ... extern long MQ; ... declare a variable and then define it down stream of our program... ... own header file for readability. ...
    (microsoft.public.vc.language)
  • Re: const and extern...
    ... extern float bar; ... a declaration), but if you merely declare it, you do not define it. ... or the translation unit ends. ... an actual definition with an initializer of: ...
    (comp.lang.c)
  • Re: confused about extern use
    ... going to achieve by declaring it as extern in the header file a.h. ... composed on one or more compilation units. ... Essentially you *declare* the type wherever it is ...
    (comp.lang.c)
  • Re: DECLARE and DLLs
    ... This PRG only does a few things. ... Just for yuks, I also tried EXTERN, DECLARE, CALL ... Meanwhile the examples in the manual involved using this command to declare ... Unknown ISEDLOADFROMFILE - Undefined ...
    (microsoft.public.fox.programmer.exchange)