Message ID | 20160713142156.GA6273@dub6 |
---|---|
State | New |
Headers | show |
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. On 07/13/2016 04:21 PM, Neels Hofmeyr wrote: > Hi Max, > > in e.g. e6052c4cc756f7d3a5023a0ba57fe8d80783967c you have added #include > <stdbool.h> in various files. > > I'd like to nitpick about the place where you put it: > > index 3cba5d1..3d7c244 100644 > --- a/openbsc/include/openbsc/gsm_subscriber.h > +++ b/openbsc/include/openbsc/gsm_subscriber.h > @@ -5,6 +5,8 @@ > #include <osmocom/core/linuxlist.h> > #include <osmocom/gsm/protocol/gsm_23_003.h> > > +#include <stdbool.h> > + > > (there are also some more instances) > > I'd prefer if we keep system headers grouped on top. > Thanks :) > > ~Neels >
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
> On 14 Jul 2016, at 02:36, Harald Welte <laforge@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
--- a/openbsc/include/openbsc/gsm_subscriber.h +++ b/openbsc/include/openbsc/gsm_subscriber.h @@ -5,6 +5,8 @@ #include <osmocom/core/linuxlist.h> #include <osmocom/gsm/protocol/gsm_23_003.h> +#include <stdbool.h> + (there are also some more instances)