mirror of
https://github.com/google/styleguide.git
synced 2024-03-22 13:11:43 +08:00
Update C++ style guide:
- Change list of permitted Boost libraries - Permit one space before // in a new {scope} - Grammar fix! Update Objective-C style guide: - Link spacing changes only
This commit is contained in:
parent
7bcc208650
commit
48fcffea4c
31
cppguide.xml
31
cppguide.xml
|
@ -2464,9 +2464,23 @@ Tashana Landray
|
||||||
Compressed Pair</a> from <code>boost/compressed_pair.hpp</code>
|
Compressed Pair</a> from <code>boost/compressed_pair.hpp</code>
|
||||||
</li>
|
</li>
|
||||||
<li> <a href="http://www.boost.org/libs/ptr_container/">
|
<li> <a href="http://www.boost.org/libs/ptr_container/">
|
||||||
Pointer Container</a> from <code>boost/ptr_container</code> except
|
Pointer Container</a> from <code>boost/ptr_container</code> except serialization
|
||||||
<code>ptr_array.hpp</code> and serialization
|
|
||||||
</li>
|
</li>
|
||||||
|
<li> <a href="http://www.boost.org/libs/array/">
|
||||||
|
Array</a> from <code>boost/array.hpp</code>
|
||||||
|
</li>
|
||||||
|
<li> <a href="http://www.boost.org/libs/graph/">
|
||||||
|
The Boost Graph Library (BGL)</a> from <code>boost/graph</code> except serialization
|
||||||
|
</li>
|
||||||
|
<li> <a href="http://www.boost.org/libs/property_map/">
|
||||||
|
Property Map</a> from <code>boost/property_map.hpp</code>
|
||||||
|
</li>
|
||||||
|
<li> The part of
|
||||||
|
<a href="http://www.boost.org/libs/iterator/">
|
||||||
|
Iterator</a> that deals with defining iterators:
|
||||||
|
<code>boost/iterator/iterator_adaptor.hpp</code>,
|
||||||
|
<code>boost/iterator/iterator_facade.hpp</code>, and
|
||||||
|
<code>boost/function_output_iterator.hpp</code></li>
|
||||||
</ul>
|
</ul>
|
||||||
We are actively considering adding other Boost features to the list, so
|
We are actively considering adding other Boost features to the list, so
|
||||||
this rule may be relaxed in the future.
|
this rule may be relaxed in the future.
|
||||||
|
@ -3167,11 +3181,13 @@ Tashana Landray
|
||||||
often be more readable to line them up:
|
often be more readable to line them up:
|
||||||
</p>
|
</p>
|
||||||
<CODE_SNIPPET>
|
<CODE_SNIPPET>
|
||||||
...
|
|
||||||
DoSomething(); // Comment here so the comments line up.
|
DoSomething(); // Comment here so the comments line up.
|
||||||
DoSomethingElseThatIsLonger(); // Comment here so there are two spaces between
|
DoSomethingElseThatIsLonger(); // Comment here so there are two spaces between
|
||||||
// the code and the comment.
|
// the code and the comment.
|
||||||
...
|
{ // One space before comment when opening a new scope is allowed,
|
||||||
|
// thus the comment lines up with the following comments and code.
|
||||||
|
DoSomethingElse(); // Two spaces before line comments normally.
|
||||||
|
}
|
||||||
</CODE_SNIPPET>
|
</CODE_SNIPPET>
|
||||||
</SUBSECTION>
|
</SUBSECTION>
|
||||||
<SUBSECTION title="NULL, true/false, 1, 2, 3...">
|
<SUBSECTION title="NULL, true/false, 1, 2, 3...">
|
||||||
|
@ -3783,10 +3799,9 @@ Tashana Landray
|
||||||
const string & str; // Bad - spaces on both sides of &
|
const string & str; // Bad - spaces on both sides of &
|
||||||
</BAD_CODE_SNIPPET>
|
</BAD_CODE_SNIPPET>
|
||||||
<p>
|
<p>
|
||||||
You should do this consistently within a single file or
|
You should do this consistently within a single
|
||||||
|
file,
|
||||||
|
so, when modifying an existing file, use the style in that
|
||||||
so when modifying an existing file, use the style in that
|
|
||||||
file.
|
file.
|
||||||
</p>
|
</p>
|
||||||
</BODY>
|
</BODY>
|
||||||
|
|
|
@ -49,13 +49,13 @@
|
||||||
Google's general recommendations. So, before reading this guide, please make
|
Google's general recommendations. So, before reading this guide, please make
|
||||||
sure you've read:
|
sure you've read:
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/index.html">Apple's Cocoa
|
<li><a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/index.html">Apple's
|
||||||
Coding Guidelines</a></li>
|
Cocoa Coding Guidelines</a></li>
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml">
|
<a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml">Google's
|
||||||
Google's Open Source C++ Style Guide</a>
|
Open Source C++ Style Guide</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -80,10 +80,10 @@
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Google has already released open-source code that conforms to these
|
Google has already released open-source code that conforms to these
|
||||||
guidelines as part of the <a href="http://code.google.com/p/google-toolbox-for-mac/">Google Toolbox for
|
guidelines as part of the <a href="http://code.google.com/p/google-toolbox-for-mac/">Google
|
||||||
Mac project</a> (abbreviated GTM throughout this document). Code meant to
|
Toolbox for Mac project</a> (abbreviated GTM throughout this document).
|
||||||
be shared across different projects is a good candidate to be included in
|
Code meant to be shared across different projects is a good candidate to
|
||||||
this repository.
|
be included in this repository.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@
|
||||||
<p>
|
<p>
|
||||||
Note that this guide is not an Objective-C tutorial. We assume that the
|
Note that this guide is not an Objective-C tutorial. We assume that the
|
||||||
reader is familiar with the language. If you are new to Objective-C or
|
reader is familiar with the language. If you are new to Objective-C or
|
||||||
need a refresher, please read <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/index.html">
|
need a refresher, please read <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/index.html">The
|
||||||
The Objective-C Programming Language</a>.
|
Objective-C Programming Language</a>.
|
||||||
</p>
|
</p>
|
||||||
</CATEGORY>
|
</CATEGORY>
|
||||||
</OVERVIEW>
|
</OVERVIEW>
|
||||||
|
@ -341,8 +341,8 @@
|
||||||
Naming rules are very important in maintainable code. Objective-C method
|
Naming rules are very important in maintainable code. Objective-C method
|
||||||
names tend to be very long, but this has the benefit that a block of code
|
names tend to be very long, but this has the benefit that a block of code
|
||||||
can almost read like prose, thus rendering many comments unnecessary. </p>
|
can almost read like prose, thus rendering many comments unnecessary. </p>
|
||||||
<p> When writing pure Objective-C code, we mostly follow standard <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html">
|
<p> When writing pure Objective-C code, we mostly follow standard <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html">Objective-C
|
||||||
Objective-C naming rules</a>. These naming guidelines may differ
|
naming rules</a>. These naming guidelines may differ
|
||||||
significantly from those outlined in the C++ style guide. For example,
|
significantly from those outlined in the C++ style guide. For example,
|
||||||
Google's C++ style guide recommends the use of underscores between words
|
Google's C++ style guide recommends the use of underscores between words
|
||||||
in variable names, whereas this guide recommends the use of intercaps,
|
in variable names, whereas this guide recommends the use of intercaps,
|
||||||
|
@ -1070,8 +1070,8 @@
|
||||||
handled by the Objective-C runtime. If the method has no return
|
handled by the Objective-C runtime. If the method has no return
|
||||||
result, you're good to go. However if there is one, there may be
|
result, you're good to go. However if there is one, there may be
|
||||||
differences based on runtime architecture, return size, and OS X
|
differences based on runtime architecture, return size, and OS X
|
||||||
version (see <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_2_section_3.html#//apple_ref/doc/uid/TP30001163-CH11-SW7">
|
version (see <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_2_section_3.html#//apple_ref/doc/uid/TP30001163-CH11-SW7">Apple's
|
||||||
Apple's documentation</a> for specifics).
|
documentation</a> for specifics).
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Note that this is very different from checking C/C++ pointers against
|
Note that this is very different from checking C/C++ pointers against
|
||||||
|
|
Loading…
Reference in New Issue
Block a user