[webkit-dev] coding style of #include statements

Osztrogonac Csaba oszi at inf.u-szeged.hu
Wed Nov 3 05:06:42 PDT 2010


Hi,

Now the second one is correct, because you should use angle
brackets <...> for system headers, and quote marks "..." for
non system headers. I think you should use "wtf/HashSet.h".

It is important, because searches order is different with <...> and "...":
http://gcc.gnu.org/onlinedocs/gcc-4.3.2//cpp/Include-Syntax.html#Include-Syntax

#include <file>:
1.) -I ... directories
2.) -isystem .. directories
3.) standard system directories

#include "file":
1.) in the directory containing the current file
2.) -iquote
2.) -I
3.) -isystem
4.) standard system directories

br,
Ossy

Patrick Roland Gansterer írta:
> Currently, the style guidelines specify "Includes of system headers must
> come after includes of other headers. "
> But what about WebKit headers in arrow brackets?
> 
> What is the correct style:
> 
> #include "ArgumentEncoder.h"
> #include "WorkItem.h"
> #include <wtf/HashSet.h>
> #include <wtf/OwnPtr.h> 
> #include <QApplication>
> #include <QLocalServer>
> 
> or 
> 
> #include "ArgumentEncoder.h"
> #include "WorkItem.h"
> #include <QApplication>
> #include <QLocalServer>
> #include <wtf/HashSet.h>
> #include <wtf/OwnPtr.h> 
> 
> I prefere the first one because <wtf/*.h> aren't real system headers.
> 
> - Patrick


More information about the webkit-dev mailing list