[asterisk-dev] header inclusion policy ?

Luigi Rizzo rizzo at icir.org
Fri Mar 24 00:59:42 MST 2006


On Thu, Mar 23, 2006 at 01:51:08PM -0600, Kevin P. Fleming wrote:
> Luigi Rizzo wrote:
> 
> > However, right now we are taking the disadvantages from both
> > solution - many files include a large set of system
> > headers (not all necessary), and application headers
> > (not all necessary), so this is approach (B) without the
> > optimization; and even more files rely on nested includes
> > from asterisk headers (so its approach (A) without the
> > design).
> 
> My preference is definitely for (B), with the most optimization

i hope you are aware that this 'optimization' has absolutely
no impact on the object code that is produced, only on the
compile times (which are not huge, anyways... and with those monster
5-10k source files that we have, it's not a few extra headers that
change things).

> possible, except for compiler/platform-specific stuff... we don't want
> #ifdefs in each source file based on the compiler chosen or the OS
> platform. Having "asterisk/compiler.h" and "asterisk/platform.h"
> included in each file takes care of that, but they should bring in
> _only_ the bits needed for those specific things.

so the problem here is that the compiler/platform issues
involve mostly system headers - e.g. one platform needs
<sys/types.h> before including timevals, another needs
the inet stuff before netinet/in.h, and so on...

the "asterisk/platform.h" will most likely end up including
a lot of system headers to cover the prerequisites for
the other #include's in regular files...

In any case, i would suggest that you/mark decide a policy and put
it into the coding guidelines so we try to gradually move
towards it.

	cheers
	luigi

> --Bandwidth and Colocation provided by Easynews.com --
> 
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev



More information about the asterisk-dev mailing list