include grouping

Holger Freyther holger at freyther.de
Thu Jul 14 06:37:54 UTC 2016


> On 14 Jul 2016, at 02:36, Harald Welte <laforge at gnumonks.org> wrote:
> 
> On Wed, Jul 13, 2016 at 04:24:48PM +0200, Max wrote:
>> I recall that I've seen both variants in source code - "system before
>> our" and "our headers before system". I'm more inclined towards latter
>> but I'm open for other opinions.
> 
> the standard omsoocm coding style is:
> * first the system include files
> * then the osmocom libraries
> * then any local includes within the project

and to add to bike shedding. If we have MODULE.h and MODULE.c., first thing MODULE.c should include is MODULE.h. This makes sure that MODULE.h has all the necessary includes to be included by itself.

I would also sort system includes last (e.g. with X11 header they would pollute your namespace and define things one should not define).

holger


More information about the OpenBSC mailing list