|
Geometry : |
Subject: [ggl] Convention of headers inclusion
From: Mateusz Loskot (mateusz)
Date: 2009-04-13 20:07:37
Barend Gehrels wrote:
>
>> Is there any convention about order in which std, boost and ggl
>> headers should be included in GGL code?
>>
> Good question. As far as I know Boost does not give a guideline about
> this. I glanced through some of the boost headers and they usually
> include boost headers first, then std headers. This is different from
> what I did, I usually put the std headers first.
I usually try to stick to a simple rule: include a std header in every
file that uses type defined in that header and avoid indirect and
implicit inclusions.
I usually put std headers as last, so I it helps me to avoid
implicit inclusion of std types.
> But it makes sense to first put the boost headers - they might
> define macro's which change the behaviour of the std library.
Yes.
> So I would propose the order is:
> 1) boost headers
> 2) geometry headers (because ggl might once belong to boost)
> within geometry:
> a) core
> b) strategies
> c) algorithms
> 3) std headers
Great. That's best practice IMHO too.
Best regards,
-- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org
Geometry list run by mateusz at loskot.net