[webkit-dev] coding style of #include statements

2010-11-03 Thread Patrick Roland Gansterer
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
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] coding style of #include statements

2010-11-03 Thread Osztrogonac Csaba

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

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] coding style of #include statements

2010-11-03 Thread Andras Becsi

Hi,

on the contrary, I think ... is correct for WTF headers, because they 
are framework headers, and the include path where the WTF headers are, 
is added with -I, so the preprocessor will find them first. That's why 
almost all WTF includes use #include ... (there are only ~20 occasions 
where  is used for WTF headers, which is wrong in my opinion, but not 
a coding style issue).


The sentence in question should rather say something about -style and 
-style header includes to avoid confusion.


That said, I think the correct order is:

#include ArgumentEncoder.h
#include WorkItem.h
#include QApplication
#include QLocalServer
#include wtf/HashSet.h
#include wtf/OwnPtr.h

because alphabetical order matters here.

BR,
Andras

On 11/03/2010 01:06 PM, Osztrogonac Csaba wrote:

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

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] coding style of #include statements

2010-11-03 Thread Darin Adler
The intent is “sorted as the classic Unix command line sort tool would sort 
them”.

-- Darin

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev