[libvirt] RFC: Coding style: require alphabetical header file sorting
Michal Privoznik
mprivozn at redhat.com
Tue Dec 4 08:59:54 UTC 2012
On 03.12.2012 17:45, Daniel P. Berrange wrote:
> Thus far we only have one rule about header files, #include <config.h>
> must be first in all .c files. I'm wondering if it is time to introduce
> some new rules
>
> - All system headers must be grouped to preceed all local headers
> - All system headers must be sorted within their group
> - All local headers must be sorted within their group
>
> This will require updating pretty much every single source and header
> file in the tree. Of course it will need a new syntax check rule to
> validate this too. Since fixing them is a serious amount of work,
> I was wondering about people's opinions on this ?
>
> The goal is just standardization to make code a little more readable.
>
> Daniel
>
I feel indifferent about the last two. Personally alphabetical sorting
would make it in fact harder if one is including twin header files, e.g.
for stat(2) you need to include:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
which makes sense to me to keep together and not break into 3 pieces.
But I understand it may be easier for somebody to have header files sorted.
ACK to the first rule though.
Michal
More information about the libvir-list
mailing list