Re: Header files included in header files

From: John Smith (soneone_at_microsoft.com)
Date: 07/22/04


Date: Thu, 22 Jul 2004 14:20:19 +0100


"John Smith" <soneone@microsoft.com> wrote in message
news:cdl6fm$lmj$1@newstree.wise.edt.ericsson.se...
> Hi all
>
> What does the group think of the practise of including one header file
from
> inside another?
>
> I have some legacy code where this has been done, and it creates a
> dependency on a module (collection of files) which are not required,
except
> for one header file's contents.
>
> I'd say 'No, header files should be included in the C source, not in
another
> header', but I've always come across strong arguments for the latter.
>
> What do you think, and what is accepted practise?
>
> Thanks
> JS
>
>

What is this obsession with replying 'Don't forget the inclusion guard'???
It's old hat. My secnario has this in place.

My problem is one module is creating a dependancy on another module only
because the first module wants to use one single #define in the second
module.

The application is a large one, backed up by an overly sophisticated build
system, which would mean if I want to pick up module 2, I pick up all of it:
it all gets compiled. (And yes, I know: it won't get linked in!).

So the question is: is it normal practise to create intermodule dependancies
for trivial reasons?



Relevant Pages

  • Header files included in header files
    ... What does the group think of the practise of including one header file from ... I have some legacy code where this has been done, ... and what is accepted practise? ...
    (comp.lang.c)
  • Re: Header files included in header files
    ... > What does the group think of the practise of including one header file from ... way that the single line source file ... Note that a function can have arguments or return values of type "struct ...
    (comp.lang.c)
  • Re: AfxGetApp() returns NULL
    ... modules are candidates for recompilation if I change something about the colors. ... Note that the scope may be the entire program, but the DEPENDENCY is not! ... My document would not care about colors; ... cases you need to include a header file to access the "global" variables. ...
    (microsoft.public.vc.mfc)
  • Re: [PATCH] include/linux/pktcdvd.h: add mempool.h dependency
    ... Subject: [PATCH] include/linux/pktcdvd.h: add mempool.h dependency ... But once the header file broke this implicit dependency got ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Managed C++ & P/Invoke in a web serice
    ... I am exploring using P/Invoke to call some legacy code from our customer ... Header file of C++ class for web service: ... Class file for web service: ...
    (microsoft.public.dotnet.languages.vc)