[Spice-devel] [PATCH 1/2] server/red_worker.h: order includes correcty

Alon Levy alevy at redhat.com
Sun Sep 1 00:24:32 PDT 2013


> Do we document anywhere what is a 'correct' order? I assume it's config.h,
> alphabetically ordered system headers (with subdirs coming last), and
> finally local headers?
> I assume this is pretty standard practice, but I always have to think to
> remember exactly how to order things :)

There is a coding standard, in pdf form, it should have this reference. The 'correct' order, as I (and Hans too it seems) see it is:
system includes
external libraries includes
internal not same file name includes
file (i.e. s/filename.c/filename.h/) include, if any

You can further subdivide, the idea being not in control of project first.

> 
> Christophe
> 
> On Thu, Aug 29, 2013 at 04:23:04PM +0300, Alon Levy wrote:
> > ---
> >  server/red_worker.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/server/red_worker.c b/server/red_worker.c
> > index 0c611d0..fc7463d 100644
> > --- a/server/red_worker.c
> > +++ b/server/red_worker.c
> > @@ -44,9 +44,10 @@
> >  #include <pthread.h>
> >  #include <netinet/tcp.h>
> >  #include <setjmp.h>
> > -#include <openssl/ssl.h>
> >  #include <inttypes.h>
> >  
> > +#include <openssl/ssl.h>
> > +
> >  #include <spice/protocol.h>
> >  #include <spice/qxl_dev.h>
> >  #include "common/lz.h"
> > --
> > 1.8.3.1
> > 
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list