<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 8, 2020 at 8:03 AM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 03/01/2020 17:52, Gedare Bloom wrote:<br>
> Hello all,<br>
> <br>
> Vijay noted in another thread that:<br>
> "For RTEMS, I don't see any preference mentioned in the docs for the<br>
> order or includes:<br>
> <a href="https://docs.rtems.org/branches/master/eng/coding-conventions.html" rel="noreferrer" target="_blank">https://docs.rtems.org/branches/master/eng/coding-conventions.html</a><br>
> <br>
> In libbsd, however, the FreeBSD style guide is followed which has a<br>
> preference for the order of header includes:<br>
> <a href="https://www.freebsd.org/cgi/man.cgi?query=style&apropos=0&sektion=9" rel="noreferrer" target="_blank">https://www.freebsd.org/cgi/man.cgi?query=style&apropos=0&sektion=9</a>"<br>
> <br>
> Should we consider any rules? I would suspect that at least ordering<br>
> by API layering could be helpful. Lexical sorting is nice but probably<br>
> there will be some exceptions based on dependencies.<br>
<br>
I would use the Google rule:<br>
<br>
<a href="https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes" rel="noreferrer" target="_blank">https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes</a><br>
<br>
It is compatible to the FreeBSD style (except the include related header <br>
first).<br></blockquote><div><br></div><div>FWIW I don't like how they worded that. I think they mean the public header files.</div><div>Related would include private header files which are grouped later. But the rationale</div><div>makes sense as long as there isn't a conditional for "inside the package" which covers</div><div>up issues.</div><div><br></div><div>There is also the issue of defining conditionals like POSIX level, GNU misc, </div><div>IN_KERNEL, etc.. I try to do that before any includes.</div><div><br></div><div>--joel</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
-- <br>
Sebastian Huber, embedded brains GmbH<br>
<br>
Address : Dornierstr. 4, D-82178 Puchheim, Germany<br>
Phone   : +49 89 189 47 41-16<br>
Fax     : +49 89 189 47 41-09<br>
E-Mail  : <a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a><br>
PGP     : Public key available on request.<br>
<br>
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a></blockquote></div></div>