[bind10-dev] networking includes
Francis Dupont
fdupont at isc.org
Mon Jul 2 10:56:26 UTC 2012
> On Sun, Jul 01, 2012 at 04:16:23PM +0000, Francis Dupont wrote:
> > There is a drastic but efficient way to solve this: add OS dependent
> > includes in the config.h (*) and of course include config.h (first!)
> > in all files showing this kind of need. The clear drawback is to
> > include too many but it is not as calling Ackermann's function in
> > templates a la boost...
>
> As you say, it is a drastic solution. Most of the .cc files we have
> don't use any networking at all.
=> it is very far from being true: in fact most of the .cc files have
a dependency on networking.
> Actually, most of the networking should be wrapped in ASIO
> anyway. Personally, I think such solution lacks the basic levels of
> elegance.
=> it is transparent for the programmer and solves the silly issue
of the ordering of includes on some systems (Linux and Windows in head :-)
> > Another question is whether to put the include for config.h in header
> > (.h) files or code (.cc) files. IMHO it is clearly the second: header
> > files should include only "internal" headers.
>
> What do you mean by header files should include only internal headers?
=> yes, highly nested includes is a sure way to deadlock from time to
time on the include order.
> I never heard about such policy and I don't think we follow it
=> the code is written for Linux and BSDs are in general very good
for this. So the code is not portable but you don't get the trouble...
> (there are many header files including something from STL or Boost).
=> STL and Boost are supposed to be reasonably safe for the order.
The problem is more with OS includes, in particular written for C.
Regards
Francis Dupont <fdupont at isc.org>
More information about the bind10-dev
mailing list