Changeset 38824 in webkit
- Timestamp:
- Nov 27, 2008 5:43:51 PM (15 years ago)
- Location:
- trunk/WebKitSite
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitSite/ChangeLog
r38760 r38824 1 2008-11-27 Julien Chaffraix <jchaffraix@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Bug 22468: Coding style: config.h should only be included in implementation files, not in header 6 https://bugs.webkit.org/show_bug.cgi?id=22468 7 8 Clarified the rules about config.h inclusion and added 2 new examples to illustrate it. Also 9 added an explanation about the implementation files. 10 11 * coding/coding-style.html: 12 1 13 2008-11-25 Dean Jackson <dino@apple.com> 2 14 -
trunk/WebKitSite/coding/coding-style.html
r38539 r38824 70 70 </li> 71 71 72 <li>In an implementation file , code inside a namespace should <em>not</em> be indented.72 <li>In an implementation file (files with the extension .cpp, .c or .mm), code inside a namespace should <em>not</em> be indented. 73 73 <h4 class="right">Right:</h4> 74 74 <pre class="code"> … … 599 599 <ol> 600 600 601 <li>All files must #include "config.h" first. 602 603 <li>All files must #include the primary header second, just after "config.h". 604 So for example, Node.cpp should include Node.h first, before other files. 605 This guarantees that each header's completeness is tested, to make sure it 606 can be compiled without requiring any other header files be included first. 601 <li>All implementation files must #include "config.h" first. Header 602 files should never include "config.h". 603 604 <h4 class="right">Right:</h4> 605 <pre class="code"> 606 // RenderLayer.h 607 #include "Node.h" 608 #include "RenderObject.h" 609 #include "RenderView.h" 610 </pre> 611 612 <h4 class="wrong">Wrong:</h4> 613 <pre class="code"> 614 // RenderLayer.h 615 #include "config.h" 616 617 #include "RenderObject.h" 618 #include "RenderView.h" 619 #include "Node.h" 620 </pre> 621 622 <li>All implementation files must #include the primary header second, 623 just after "config.h". So for example, Node.cpp should include Node.h first, 624 before other files. This guarantees that each header's completeness is tested. 625 This also assures that each header can be compiled without requiring any other 626 header files be included first. 607 627 608 628 <li>Other #include statements should be in sorted order (case sensitive, as … … 610 630 Don't bother to organize them in a logical order. 611 631 632 <h4 class="right">Right:</h4> 633 <pre class="code"> 634 // HTMLDivElement.cpp 635 #include "config.h" 636 #include "HTMLDivElement.h" 637 638 #include "Attribute.h" 639 #include "HTMLElement.h" 640 #include "QualifiedName.h" 641 642 </pre> 643 644 <h4 class="wrong">Wrong:</h4> 645 <pre class="code"> 646 // HTMLDivElement.cpp 647 #include "HTMLElement.h" 648 #include "HTMLDivElement.h" 649 #include "QualifiedName.h" 650 #include "Attribute.h" 651 </pre> 652 612 653 </ol> 613 654
Note: See TracChangeset
for help on using the changeset viewer.