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>
|
||||
</li>
|
||||
<li> <a href="http://www.boost.org/libs/ptr_container/">
|
||||
Pointer Container</a> from <code>boost/ptr_container</code> except
|
||||
<code>ptr_array.hpp</code> and serialization
|
||||
Pointer Container</a> from <code>boost/ptr_container</code> except serialization
|
||||
</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>
|
||||
We are actively considering adding other Boost features to the list, so
|
||||
this rule may be relaxed in the future.
|
||||
|
@ -3167,11 +3181,13 @@ Tashana Landray
|
|||
often be more readable to line them up:
|
||||
</p>
|
||||
<CODE_SNIPPET>
|
||||
...
|
||||
DoSomething(); // Comment here so the comments line up.
|
||||
DoSomethingElseThatIsLonger(); // Comment here so there are two spaces between
|
||||
// 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>
|
||||
</SUBSECTION>
|
||||
<SUBSECTION title="NULL, true/false, 1, 2, 3...">
|
||||
|
@ -3783,10 +3799,9 @@ Tashana Landray
|
|||
const string & str; // Bad - spaces on both sides of &
|
||||
</BAD_CODE_SNIPPET>
|
||||
<p>
|
||||
You should do this consistently within a single file or
|
||||
|
||||
|
||||
so when modifying an existing file, use the style in that
|
||||
You should do this consistently within a single
|
||||
file,
|
||||
so, when modifying an existing file, use the style in that
|
||||
file.
|
||||
</p>
|
||||
</BODY>
|
||||
|
|
|
@ -49,13 +49,13 @@
|
|||
Google's general recommendations. So, before reading this guide, please make
|
||||
sure you've read:
|
||||
<ul>
|
||||
<li><a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/index.html">Apple's Cocoa
|
||||
Coding Guidelines</a></li>
|
||||
<li><a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CodingGuidelines/index.html">Apple's
|
||||
Cocoa Coding Guidelines</a></li>
|
||||
<li>
|
||||
|
||||
<div>
|
||||
<a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml">
|
||||
Google's Open Source C++ Style Guide</a>
|
||||
<a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml">Google's
|
||||
Open Source C++ Style Guide</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -80,10 +80,10 @@
|
|||
|
||||
<p>
|
||||
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
|
||||
Mac project</a> (abbreviated GTM throughout this document). Code meant to
|
||||
be shared across different projects is a good candidate to be included in
|
||||
this repository.
|
||||
guidelines as part of the <a href="http://code.google.com/p/google-toolbox-for-mac/">Google
|
||||
Toolbox for Mac project</a> (abbreviated GTM throughout this document).
|
||||
Code meant to be shared across different projects is a good candidate to
|
||||
be included in this repository.
|
||||
</p>
|
||||
|
||||
|
||||
|
@ -91,8 +91,8 @@
|
|||
<p>
|
||||
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
|
||||
need a refresher, please read <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/index.html">
|
||||
The Objective-C Programming Language</a>.
|
||||
need a refresher, please read <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/index.html">The
|
||||
Objective-C Programming Language</a>.
|
||||
</p>
|
||||
</CATEGORY>
|
||||
</OVERVIEW>
|
||||
|
@ -341,8 +341,8 @@
|
|||
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
|
||||
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">
|
||||
Objective-C naming rules</a>. These naming guidelines may differ
|
||||
<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
|
||||
naming rules</a>. These naming guidelines may differ
|
||||
significantly from those outlined in the C++ style guide. For example,
|
||||
Google's C++ style guide recommends the use of underscores between words
|
||||
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
|
||||
result, you're good to go. However if there is one, there may be
|
||||
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">
|
||||
Apple's documentation</a> for specifics).
|
||||
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
|
||||
documentation</a> for specifics).
|
||||
</p>
|
||||
<p>
|
||||
Note that this is very different from checking C/C++ pointers against
|
||||
|
|
Loading…
Reference in New Issue
Block a user