diff --git a/cppguide.xml b/cppguide.xml index 65446b0..e87b36f 100644 --- a/cppguide.xml +++ b/cppguide.xml @@ -4,7 +4,7 @@

-Revision 3.231 +Revision 3.245

@@ -364,7 +364,7 @@ Tashana Landray

  1. dir2/foo2.h (preferred location - — see details below).
  2. + — see details below).
  3. C system files.
  4. C++ system files.
  5. Other libraries' .h files.
  6. @@ -779,6 +779,8 @@ Tashana Landray Static or global variables of class type are forbidden: they cause hard-to-find bugs due to indeterminate order of construction and destruction. + However, such variables are allowed if they are constexpr: + they have no dynamic initialization or destruction.

    @@ -1560,7 +1562,8 @@ Tashana Landray arguments are values or const references while output arguments are pointers. Input parameters may be const pointers, but we never allow - non-const reference parameters. + non-const reference parameters + except when required by convention, e.g., swap().

    @@ -2159,6 +2162,8 @@ Tashana Landray

    Use const whenever it makes sense. + With C++11, + constexpr is a better choice for some uses of const. @@ -2243,6 +2248,51 @@ Tashana Landray + + + In C++11, use constexpr + to define true constants or to ensure constant initialization. + + + + Some variables can be declared constexpr + to indicate the variables are true constants, + i.e. fixed at compilation/link time. + Some functions and constructors can be declared constexpr + which enables them to be used + in defining a constexpr variable. + + + Use of constexpr enables + definition of constants with floating-point expressions + rather than just literals; + definition of constants of user-defined types; and + definition of constants with function calls. + + + Prematurely marking something as constexpr + may cause migration problems if later on it has to be downgraded. + + Current restrictions on what is allowed + in constexpr functions and constructors + may invite obscure workarounds in these definitions. + + +

    + constexpr definitions enable a more robust + specification of the constant parts of an interface. + Use constexpr to specify true constants + and the functions that support their definitions. + Avoid complexifying function definitions to enable + their use with constexpr. + Do not use constexpr to force inlining. +

    + + +
    + +
    + Of the built-in C++ integer types, the only one used @@ -2251,7 +2301,12 @@ Tashana Landray size, use a precise-width integer type from - <stdint.h>, such as int16_t. + <stdint.h>, such as int16_t. If + your variable represents a value that could ever be greater than or + equal to 2^31 (2GiB), use a 64-bit type such as int64_t. + Keep in mind that even if your value won't ever be too large for an + int, it may be used in intermediate calculations which may + require a larger type. When in doubt, choose a larger type. @@ -2301,14 +2356,24 @@ Tashana Landray

    You should not use the unsigned integer types such as uint32_t, - unless the quantity you are representing is really a bit pattern - rather than a number, or unless you need defined - twos-complement overflow. In particular, do not use unsigned - types to say a number will never be negative. Instead, use + unless there is a valid reason such as representing a bit pattern + rather than a number, or you need defined overflow modulo 2^N. + In particular, do not use unsigned types to say a number will never + be negative. Instead, use assertions for this.

    +

    + If your code is a container that returns a size, be sure to use + a type that will accommodate any possible usage of your container. + When in doubt, use a larger type rather than a smaller type. +

    +

    + Use care when converting integer types. Integer conversions and + promotions can cause non-intuitive behavior. + +

    @@ -2571,16 +2636,21 @@ Tashana Landray - Use sizeof(varname) instead of - sizeof(type) whenever possible. + Prefer sizeof(varname) to + sizeof(type).

    - Use sizeof(varname) because it will update - appropriately if the type of the variable changes. - sizeof(type) may make sense in some cases, - but should generally be avoided because it can fall out of sync if - the variable's type changes. + Use sizeof(varname) + when you take the size of a particular variable. + sizeof(varname) will update + appropriately if someone changes the variable type + either now or later. + You may use sizeof(type) + for code unrelated to any particular variable, + such as code that manages an external or internal + data format where a variable of an appropriate C++ type + is not convenient.

    @@ -2590,6 +2660,12 @@ Tashana Landray memset(&data, 0, sizeof(Struct)); + + if (raw_size < sizeof(int)) { + LOG(ERROR) << "compressed record not big enough for count: " << raw_size; + return false; + } +

    @@ -2666,7 +2742,7 @@ Tashana Landray auto x(3); // Note: parentheses. auto y{3}; // Note: curly braces. - mean different things — x is + mean different things — x is an int, while y is an initializer_list. The same applies to other normally-invisible proxy types. @@ -2752,6 +2828,13 @@ Tashana Landray boost/iterator/iterator_adaptor.hpp, boost/iterator/iterator_facade.hpp, and boost/function_output_iterator.hpp +
  7. The part of + + Polygon that deals with Voronoi diagram construction and + doesn't depend on the rest of Polygon: + boost/polygon/voronoi_builder.hpp, + boost/polygon/voronoi_diagram.hpp, and + boost/polygon/voronoi_geometry_type.hpp
  8. We are actively considering adding other Boost features to the list, so this rule may be relaxed in the future. @@ -2795,7 +2878,7 @@ Tashana Landray

    As with Boost, some C++11 extensions encourage - coding practices that hamper readability—for example by removing + coding practices that hamper readability—for example by removing checked redundancy (such as type names) that may be helpful to readers, or by encouraging template metaprogramming. Other extensions duplicate functionality available through existing @@ -2809,6 +2892,8 @@ Tashana Landray Currently only the following C++11 features are approved:

    • auto (for local variables only).
    • +
    • + constexpr (for ensuring constants).
    • Use of >> with no intervening space to close multiple levels of template arguments, as in set<list<string>>, @@ -2830,6 +2915,9 @@ Tashana Landray whose signatures contain initializer lists.
    • Use of local types as template parameters.
    • nullptr and nullptr_t.
    • +
    • static_assert.
    • +
    • Everything in <tuple>. +
    Other features will be approved individually as appropriate. Avoid writing code that is incompatible with C++11 (even though it @@ -2995,8 +3083,8 @@ Tashana Landray

    - The names of all types — classes, structs, typedefs, and enums - — have the same naming convention. Type names should start + The names of all types — classes, structs, typedefs, and enums + — have the same naming convention. Type names should start with a capital letter and have a capital letter for each new word. No underscores. For example:

    @@ -3267,7 +3355,7 @@ Tashana Landray When writing your comments, write for your audience: the next contributor - who will need to understand your code. Be generous — the next + who will need to understand your code. Be generous — the next one may be you!

    @@ -3802,7 +3890,7 @@ Tashana Landray an encoding understood by most tools able to handle more than just ASCII. Hex encoding is also OK, and encouraged where it enhances - readability — for example, "\xEF\xBB\xBF" is the + readability — for example, "\xEF\xBB\xBF" is the Unicode zero-width no-break space character, which would be invisible if included in the source as straight UTF-8.

    @@ -3956,22 +4044,26 @@ Tashana Landray argument4);

    - If the function signature is so long that it cannot fit within - the maximum line length, you may - place all arguments on subsequent lines: + Arguments may optionally all be placed on subsequent lines, with one + line per argument:

    if (...) { ... ... if (...) { - DoSomethingThatRequiresALongFunctionName( - very_long_argument1, // 4 space indent + DoSomething( + argument1, // 4 space indent argument2, argument3, argument4); } +

    + In particular, this should be done if the function signature is so long + that it cannot fit within the maximum line + length. +

    @@ -4097,8 +4189,9 @@ Tashana Landray - Switch statements may use braces for blocks. Empty loop bodies should use - {} or continue. + Switch statements may use braces for blocks. Annotate non-trivial + fall-through between cases. Empty loop bodies should use {} + or continue.

    @@ -4130,6 +4223,8 @@ Tashana Landray } } + +

    Empty loop bodies should use {} or continue, but not a single semicolon. @@ -4708,7 +4803,7 @@ Tashana Landray


    -Revision 3.231 +Revision 3.245

    diff --git a/htmlcssguide.xml b/htmlcssguide.xml index 0687978..2d6edeb 100644 --- a/htmlcssguide.xml +++ b/htmlcssguide.xml @@ -3,22 +3,22 @@

    - Revision 2.19 + Revision 2.21

    - + This style guide contains many details that are initially hidden from view. They are marked by the triangle icon, which you see here on your left. Click it now. - You should see “Hooray” appear below. + You should see “Hooray” appear below.

    Hooray! Now you know you can expand points to get more - details. Alternatively, there’s a “toggle all” at the + details. Alternatively, there’s a “toggle all” at the top of this document.

    @@ -52,8 +52,8 @@ files are not available over both protocols.

    - Omitting the protocol—which makes the URL - relative—prevents mixed content issues and results in + Omitting the protocol—which makes the URL + relative—prevents mixed content issues and results in minor file size savings.

    @@ -88,7 +88,7 @@

    - Don’t use tabs or mix tabs and spaces for indentation. + Don’t use tabs or mix tabs and spaces for indentation.

    <ul> @@ -109,9 +109,9 @@

    - All code has to be lowercase: This applies to element names, + All code has to be lowercase: This applies to HTML element names, attributes, attribute values (unless - text/CDATA), selectors, properties, and + text/CDATA), CSS selectors, properties, and property values (with the exception of strings).

    @@ -122,9 +122,17 @@ <!-- Recommended --> <img src="google.png" alt="Google">
    + + /* Not recommended */ + color: #E5E5E5; + + + /* Recommended */ + color: #e5e5e5; +
    - + Remove trailing white spaces. @@ -181,11 +189,11 @@ (This item is optional as it is not deemed a realistic expectation to always demand fully documented code. Mileage may vary heavily for HTML and CSS code and depends on the - project’s complexity.) + project’s complexity.)

    - + Mark todos and action items with TODO. @@ -220,7 +228,7 @@
    - + Use HTML5. @@ -230,7 +238,7 @@ <!DOCTYPE html>.

    - (It’s recommended to use HTML, as text/html. Do not use + (It’s recommended to use HTML, as text/html. Do not use XHTML. XHTML, as application/xhtml+xml, lacks both browser and infrastructure support and offers less room for optimization than HTML.) @@ -241,7 +249,7 @@

    - + Use valid HTML where possible. @@ -252,8 +260,7 @@

    - Use tools such as the - W3C + Use tools such as the W3C HTML validator to test.

    @@ -281,7 +288,7 @@

    - Use elements (sometimes incorrectly called “tags”) for what + Use elements (sometimes incorrectly called “tags”) for what they have been created for. For example, use heading elements for headings, p elements for paragraphs, a elements for anchors, etc. @@ -301,7 +308,7 @@ - +

    Provide alternative contents for multimedia. @@ -338,7 +345,7 @@
    - + Separate structure from presentation from behavior. @@ -374,9 +381,9 @@ <link rel="stylesheet" href="grid.css" media="screen"> <link rel="stylesheet" href="print.css" media="print"> <h1 style="font-size: 1em;">HTML sucks</h1> - <p>I’ve read about this on a few sites but now I’m sure: + <p>I’ve read about this on a few sites but now I’m sure: <u>HTML is stupid!!1</u> - <center>I can’t believe there’s no way to control the styling of + <center>I can’t believe there’s no way to control the styling of my website without doing everything all over again!</center> @@ -385,14 +392,14 @@ <title>My first CSS-only redesign</title> <link rel="stylesheet" href="default.css"> <h1>My first CSS-only redesign</h1> - <p>I’ve read about this on a few sites but today I’m actually + <p>I’ve read about this on a few sites but today I’m actually doing it: separating concerns and avoiding anything in the HTML of my website that is presentational. - <p>It’s awesome! + <p>It’s awesome! - + Do not use entity references. @@ -407,7 +414,7 @@

    The only exceptions apply to characters with special meaning in HTML (like < and &) as - well as control or “invisible” characters (like no-break + well as control or “invisible” characters (like no-break spaces).

    @@ -416,11 +423,11 @@ <!-- Recommended --> - The currency symbol for the Euro is “€”. + The currency symbol for the Euro is “€”.
    - + Omit optional tags (optional). @@ -433,9 +440,9 @@

    (This approach may require a grace period to be established - as a wider guideline as it’s significantly different + as a wider guideline as it’s significantly different from what web developers are typically taught. For - consistency and simplicity reasons it’s best served + consistency and simplicity reasons it’s best served omitting all optional tags, not just a selection.)

    @@ -458,7 +465,7 @@
    - + Omit type attributes for style sheets and scripts. @@ -499,7 +506,7 @@
    - + Use a new line for every block, list, or table element, and indent every such child element. @@ -517,7 +524,7 @@

    (If you run into issues around whitespace between list items - it’s acceptable to put all li elements in one + it’s acceptable to put all li elements in one line. A linter is encouraged to throw a warning instead of an error.)

    @@ -547,7 +554,7 @@ - + When quoting attributes values, use double quotation marks. @@ -569,7 +576,7 @@ - + Use valid CSS where possible. @@ -580,8 +587,7 @@

    - Use tools such as the - W3C + Use tools such as the W3C CSS validator to test.

    @@ -591,7 +597,7 @@

    - + Use meaningful or generic ID and class names. @@ -609,7 +615,7 @@

    Generic names are simply a fallback for elements that have no particular or no meaning different from their siblings. They are - typically needed as “helpers.” + typically needed as “helpers.”

    Using functional or generic names reduces the probability of @@ -635,7 +641,7 @@ - +

    Use ID and class names that are as short as possible but as long as necessary. @@ -662,7 +668,7 @@ - + Avoid qualifying ID and class names with type selectors. @@ -671,8 +677,7 @@ use element names in conjunction with IDs or classes.

    - Avoiding unnecessary ancestor selectors is useful for - performance + Avoiding unnecessary ancestor selectors is useful for performance reasons.

    @@ -687,14 +692,13 @@
    - + Use shorthand properties where possible.

    - CSS offers a variety of - shorthand + CSS offers a variety of shorthand properties (like font) that should be used whenever possible, even in cases where only one value is explicitly set. @@ -722,9 +726,9 @@ - +

    - Omit unit specification after “0” values. + Omit unit specification after “0” values.

    @@ -739,7 +743,7 @@

    - Omit leading “0”s in values. + Omit leading “0”s in values.

    @@ -751,7 +755,7 @@ - +

    Use 3 character hexadecimal notation where possible. @@ -794,7 +798,7 @@
    - + Separate words in ID and class names by a hyphen. @@ -805,7 +809,7 @@ in order to improve understanding and scannability.

    - /* Not recommended: does not separate the words “demo” and “image” */ + /* Not recommended: does not separate the words “demo” and “image” */ .demoimage {} /* Not recommended: uses underscore instead of hyphen */ @@ -820,12 +824,12 @@
    - Avoid user agent detection as well as CSS “hacks”—try a different + Avoid user agent detection as well as CSS “hacks”—try a different approach first.

    - It’s tempting to address styling differences over user + It’s tempting to address styling differences over user agent detection or special CSS filters, workarounds, and hacks. Both approaches should be considered last resort in order to achieve and maintain an efficient and manageable @@ -833,7 +837,7 @@ free pass will hurt projects in the long run as projects tend to take the way of least resistance. That is, allowing and making it easy to use detection and hacks means using - detection and hacks more frequently—and more frequently + detection and hacks more frequently—and more frequently is too frequently.

    @@ -843,7 +847,7 @@ - + Alphabetize declarations. @@ -870,7 +874,7 @@ - + Indent all block content. @@ -892,7 +896,7 @@ - + Use a semicolon after every declaration. @@ -917,9 +921,9 @@ - + - Use a space after a property name’s colon. + Use a space after a property name’s colon.

    @@ -940,7 +944,41 @@ - + +

    + Use a space between the last selector and the declaration block. + + +

    + Always use a single space between the last selector and the opening + brace that begins the declaration + block. +

    +

    + The opening brace should be on the same line as the last selector in a + given rule. +

    + + /* Not recommended: missing space */ + #video{ + margin-top: 1em; + } + + /* Not recommended: unnecessary line break */ + #video + { + margin-top: 1em; + } + + + /* Recommended */ + #video { + margin-top: 1em; + } + + +
    + Separate selectors and declarations by new lines. @@ -965,13 +1003,13 @@ - + Separate rules by new lines.

    - Always put a line between rules. + Always put a blank line (two line breaks) between rules.

    html { @@ -985,7 +1023,7 @@
    - + Use single quotation marks for attribute selectors and property values. @@ -997,7 +1035,7 @@

    Exception: If you do need to use the @charset rule, - use double quotation marks—single + use double quotation marks—single quotation marks are not permitted.

    @@ -1022,7 +1060,7 @@ - + Group sections by a section comment (optional). @@ -1053,7 +1091,7 @@ Be consistent.

    - If you’re editing code, take a few minutes to look at the code + If you’re editing code, take a few minutes to look at the code around you and determine its style. If they use spaces around all their arithmetic operators, you should too. If their comments have little boxes of hash marks around them, make your @@ -1061,8 +1099,8 @@

    The point of having style guidelines is to have a common vocabulary - of coding so people can concentrate on what you’re saying rather - than on how you’re saying it. We present global style rules here so + of coding so people can concentrate on what you’re saying rather + than on how you’re saying it. We present global style rules here so people know the vocabulary, but local style is also important. If code you add to a file looks drastically different from the existing code around it, it throws readers out of their rhythm when they go to @@ -1071,7 +1109,7 @@

    - Revision 2.19 + Revision 2.21

    diff --git a/javascriptguide.xml b/javascriptguide.xml index 32e9e63..282f8b7 100644 --- a/javascriptguide.xml +++ b/javascriptguide.xml @@ -3,14 +3,14 @@

    - Revision 2.64 + Revision 2.72

    Aaron Whyte
    Bob Jervis
    Dan Pupius
    - Eric Arvidsson
    + Erik Arvidsson
    Fritz Schneider
    Robby Walker
    @@ -96,7 +96,7 @@ boolean) are constant values.

    Objects' - immutabilty is more subjective — objects should be + immutabilty is more subjective — objects should be considered immutable only if they do not demonstrate obeserverable state change. This is not enforced by the compiler.

    @@ -729,11 +729,10 @@
      -
    • Private properties, variables, and methods (in files - or classes) should be named with a trailing - underscore. +
    • Private properties and methods should be named with a + trailing underscore.
    • -
    • Protected properties, variables, and methods should be +
    • Protected properties and methods should be named without a trailing underscore (like public ones).

    For more information on private and protected, @@ -892,7 +891,8 @@ staticHelper(new MyClass()); }; -

    Do not alias namespaces.

    +

    Do not create local aliases of namespaces. Namespaces should only + be aliased using goog.scope.

    myapp.main = function() { var namespace = some.long.namespace; @@ -999,7 +999,7 @@ var obj = {a: 1, b: 2, c: 3}; // No space after { or before }.

    Multiline array initializers and object initializers are indented - 2 spaces, just like blocks.

    + 2 spaces, with the braces on their own line, just like blocks.

    // Object initializer. var inset = { @@ -1127,6 +1127,7 @@
    +

    goog.scope may be used to shorten references to @@ -2204,7 +2205,10 @@

    All files, classes, methods and properties should be documented with JSDoc comments with the appropriate tags - and types.

    + and types. Textual descriptions for methods, + method parameters and method return values should be included + unless obvious from the method or parameter name. +

    Inline comments should be of the // variety.

    @@ -2438,15 +2442,15 @@ @const - @const + @const
    + @const {type}

    For example:

    /** @const */ var MY_BEER = 'stout'; /** * My namespace's favorite kind of beer. - * @const - * @type {string} + * @const {string} */ mynamespace.MY_BEER = 'stout'; @@ -2476,7 +2480,7 @@

    When @const is applied to a method, it implies the method is not only not overwritable, but also - that the method is finalized — + that the method is finalized — not overridable in subclasses.

    For more on @const, see the @@ -2861,6 +2865,10 @@ + + + + @noalias @@ -2962,13 +2970,13 @@ @private - @private + @private
    + @private {type}

    For example:

    /** * Handlers that are listening to this logger. - * @type Array.<Function> - * @private + * @private {!Array.<Function>} */ this.handlers_ = []; @@ -2985,7 +2993,8 @@ @protected - @protected + @protected
    + @protected {type}

    For example:

    /** @@ -3222,6 +3231,9 @@ complex type. + + + @@ -3527,7 +3539,7 @@

    - Revision 2.64 + Revision 2.72

    diff --git a/lispguide.xml b/lispguide.xml index ad9a7ce..e09dd91 100644 --- a/lispguide.xml +++ b/lispguide.xml @@ -5,7 +5,7 @@

    -Revision 1.17 +Revision 1.18

    @@ -13,7 +13,7 @@ Revision 1.17 Robert Brown
    - François-René Rideau + François-René Rideau
    @@ -21,7 +21,7 @@ Robert Brown

    -Patterns mean "I have run out of language." — Rich Hickey +Patterns mean "I have run out of language." — Rich Hickey

    @@ -305,7 +305,7 @@ Robert Brown
  9. Every developer's code must be easy for another developer to read, understand, and modify - — even if the first developer isn't around to explain it. + — even if the first developer isn't around to explain it. (This is the "hit by a truck" principle.)
  10. @@ -314,7 +314,7 @@ Robert Brown and recognize it as "Fred's code" by its style.
  11. - Don't be "clever" — + Don't be "clever" — do the simplest thing that could possibly work properly.
  12. @@ -324,7 +324,7 @@ Robert Brown Be concise.
  13. - KISS — Keep It Simple, Stupid. + KISS — Keep It Simple, Stupid.
  14. Use the smallest hammer for the job. @@ -411,7 +411,7 @@ Robert Brown (including QA or Ops), or otherwise isn't purely local, you must write it up using at least a couple of paragraphs, and get a design approval from the other parties involved - before starting to write code — or be ready to scratch what you have + before starting to write code — or be ready to scratch what you have when they object.

    @@ -1344,7 +1344,7 @@ Robert Brown it's good to call it row or first-row or something like that. It is alright is row has been - DEFTYPE'd to STRING — + DEFTYPE'd to STRING — precisely because you have abstracted the detail away, and the remaining salient point is that it is a row. You should not name the variable STRING in this context, @@ -1627,7 +1627,7 @@ Robert Brown

    Common Lisp systems are not required to implement function calls from tail positions without leaking stack space - — which is known as proper tail calls (PTC), + — which is known as proper tail calls (PTC), tail call elimination (TCE), or tail call optimization (TCO). This means that indefinite recursion through tail calls @@ -1886,7 +1886,7 @@ Robert Brown

  15. (error (make-condition 'foo-error ...)) - is equivalent to (error 'foo-error ...) — + is equivalent to (error 'foo-error ...) — code must use the shorter form.
  16. @@ -2241,7 +2241,7 @@ Robert Brown When you write a macro-defining macro (a macro that generates macros), document and comment it particularly clearly, - since these are hard for the uninitiated to understand. + since these are harder to understand.

    You must not install new reader macros @@ -2284,7 +2284,7 @@ Robert Brown By keeping semantics outside the macro, the macro is made simpler, easier to get right, and less subject to change, which makes it easier to develop and maintain. - The semantics is written in a simpler language — one without staging — + The semantics is written in a simpler language — one without staging — which also makes it easier to develop and maintain. It becomes possible to debug and update the semantic function without having to recompile all clients of the macro. @@ -2304,7 +2304,7 @@ Robert Brown which can be done using FLET. This also allows you to declare the function to be of dynamic extent - (if it is — and often it is; yet see below regarding + (if it is — and often it is; yet see below regarding DYNAMIC-EXTENT).

    @@ -2986,7 +2986,7 @@ Robert Brown

    However, don't use PROGN for an IF clause - — use COND, WHEN, or UNLESS. + — use COND, WHEN, or UNLESS.

    Note that in Common Lisp, @@ -3237,7 +3237,7 @@ Robert Brown

    Code must not use PRINT-OBJECT - to communicate with a user — + to communicate with a user — PRINT-OBJECT is for debugging purposes only. Modifying any PRINT-OBJECT method must not break any public interfaces. @@ -3464,7 +3464,7 @@ Robert Brown If the assertion is wrong, i.e. if the programmer's claim is not true, the results can be catastrophic: Lisp can terminate any time after the function returns, - or it hang forever, or — worst of all — + or it hang forever, or — worst of all — produce incorrect results without any runtime error!

    @@ -3693,7 +3693,7 @@ Robert Brown in a heavily functional style, you may consider using lambda-reader, - a system that lets you use the unicode character λ + a system that lets you use the unicode character λ instead of LAMBDA. But you must not start using such a syntactic extension in an existing system without getting permission from other developers. @@ -3890,7 +3890,7 @@ Robert Brown

    -Revision 1.17 +Revision 1.18

    @@ -3899,7 +3899,7 @@ Robert Brown
    - François-René Rideau + François-René Rideau
    diff --git a/objcguide.xml b/objcguide.xml index 6c37a79..6c7ae77 100644 --- a/objcguide.xml +++ b/objcguide.xml @@ -4,7 +4,7 @@

    -Revision 2.48 +Revision 2.52

    @@ -564,7 +564,7 @@ Revision 2.48 File names should reflect the name of the class implementation that - they contain—including case. Follow the convention that your + they contain—including case. Follow the convention that your project uses. @@ -700,6 +700,18 @@ Revision 2.48 There should be a single space between the class name and the opening parenthesis of the category.

    + + // Extending a framework class: + @interface NSString (GTMStringParsingAdditions) + - (NSString *)gtm_foobarString; + @end + + // Making your methods and properties private: + @interface FoobarViewController () + @property(nonatomic, retain) NSView *dongleView; + - (void)performLayout; + @end + @@ -805,7 +817,7 @@ Revision 2.48 When writing your comments, write for your audience: the next contributor - who will need to understand your code. Be generous—the next + who will need to understand your code. Be generous—the next one may be you!

    @@ -1061,7 +1073,7 @@ Revision 2.48

    Unlike C++, Objective-C doesn't have a way to differentiate between - public and private methods—everything is public. As a result, + public and private methods—everything is public. As a result, avoid placing methods in the public API unless they are actually expected to be used by a consumer of the class. This helps reduce the likelihood they'll be called when you're not expecting it. This includes @@ -1681,6 +1693,11 @@ Revision 2.48 the default. Properties, on the other hand, should always specify the strong keyword rather than relying on the compiler default.

    +

    + Files that are compiled using ARC need to have preprocessor directives + to prevent compilation without ARC. See the code snippet below for + details. +

    @@ -1695,9 +1712,8 @@ Revision 2.48 #import "Foo.h" @implementation Foo { - @private - Bar * __weak _bar; - Baz * __unsafe_unretained _baz; + Bar* __weak _bar; + Baz* __unsafe_unretained _baz; } // ... @end @@ -1822,7 +1838,7 @@ Revision 2.48


    -Revision 2.48 +Revision 2.52

    diff --git a/pyguide.html b/pyguide.html index 3c6a3e0..7213d7a 100644 --- a/pyguide.html +++ b/pyguide.html @@ -136,7 +136,7 @@

    Google Python Style Guide

    - Revision 2.45 + Revision 2.48

    @@ -1246,9 +1246,11 @@ from sound.effects import echo
    +

    + Within comments, put long URLs on their own line if necessary. +

    + +
    Yes:  # See details at
    +      # http://www.example.com/us/developer/documentation/api/content/v2.0/csv_file_name_extension_full_specification.html
    + +
    No:  # See details at
    +     # http://www.example.com/us/developer/documentation/api/content/\
    +     # v2.0/csv_file_name_extension_full_specification.html
    +

    Make note of the indentation of the elements in the line continuation examples above; see the @@ -2223,7 +2236,7 @@ Don't do this.

    -Revision 2.45 +Revision 2.48