Changeset 51929 in webkit
- Timestamp:
- Dec 9, 2009 3:08:44 PM (14 years ago)
- Location:
- trunk/WebKitSite
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitSite/ChangeLog
r51733 r51929 1 2009-12-09 Chris Jerdonek <chris.jerdonek@gmail.com> 2 3 Reviewed by Darin Adler. 4 5 Added the "using std::foo" rule to the coding style guidelines. 6 7 https://bugs.webkit.org/show_bug.cgi?id=32301 8 9 Added to the coding style guidelines the "using std::foo" rule 10 checked by the check-webkit-style script. Also clarified the 11 "using" statement guidelines that apply to implementation files. 12 13 * coding/coding-style.html: 14 1 15 2009-12-05 Chris Jerdonek <chris.jerdonek@gmail.com> 2 16 -
trunk/WebKitSite/coding/coding-style.html
r51733 r51929 710 710 <ol> 711 711 712 <li>In header files, do not use "using" statements in global or713 "namespace"scope.712 <li>In header files, do not use "using" statements in namespace 713 (or global) scope. 714 714 715 715 <h4 class="right">Right:</h4> … … 742 742 </li> 743 743 744 <li>I t is acceptable, however, to use "using" declarations at the end of745 header files in the WTF sub-library to include one or more names in 746 the WTF namespace into the global scope.744 <li>In header files in the WTF sub-library, however, it is acceptable 745 to use "using" declarations at the end of the file to import one 746 or more names in the WTF namespace into the global scope. 747 747 748 748 <h4 class="right">Right:</h4> … … 778 778 </li> 779 779 780 <li>Any "using namespace" statements for a nested namespace whose parent namespace 781 is also defined in a file must be declared within that namespace definition. 780 <li>In C++ implementation files, do not use statements of the form 781 "using std::foo" to import names in the standard template library. 782 Use "using namespace std" instead. 782 783 783 784 <h4 class="right">Right:</h4> … … 785 786 // HTMLBaseElement.cpp 786 787 788 using namespace std; 789 790 namespace WebCore { 791 792 } // namespace WebCore 793 </pre> 794 795 <h4 class="wrong">Wrong:</h4> 796 <pre class="code"> 797 // HTMLBaseElement.cpp 798 799 using std::swap; 800 801 namespace WebCore { 802 803 } // namespace WebCore 804 </pre> 805 </li> 806 807 <li>In implementation files, if a "using namespace" statement is 808 for a nested namespace whose parent namespace is defined in the file, 809 put the statement inside that namespace definition. 810 811 <h4 class="right">Right:</h4> 812 <pre class="code"> 813 // HTMLBaseElement.cpp 814 787 815 namespace WebCore { 788 816 … … 804 832 </li> 805 833 806 <li>Any other "using namespace" statements must be declared before the first namespace 807 definition in the file. 834 <li>In implementation files, put all other "using" statements 835 at the beginning of the file, before any namespace definitions and 836 after any "include" statements. 837 808 838 <h4 class="right">Right:</h4> 809 839 <pre class="code">
Note: See TracChangeset
for help on using the changeset viewer.