aboutsummaryrefslogtreecommitdiff
path: root/cppguide.xml
AgeCommit message (Collapse)Author
2014-09-08Update C++ style guide to 4.45.mark@chromium.org
Much of the guide has been refactored, rewritten, and revised.
2013-09-25Update C++ style guide to 3.274:mark@chromium.org
- Change formatting rules of braced initializers. - Permit use of constexpr and allow constexpr global variables. - Allow all C++11 features except for those that are specifically banned. - Fix/add C99 format specifiers for ptrdiff_t and ssize_t. - Add lambda expressions to the list of explicitly banned C++11 features. - Relax "return type is always on the same line as the function name" rule. - Allow unique_ptr, discourage ownership transfer. Allow noncopyable std::move. - Allow system-specific includes after other includes. - Add boost/math/distributions to the set of permitted Boost libraries. Update Objective-C style guide to 2.59: - Use instancetype as return type for example init methods. - Remove invalid +stringWithInt: call. - Remove reference to pre-Objective-C 2.0 declaration requirements. - Remove reference to Objective-C exception macros. - Remove reference to informal protocols as an alternative to optional methods. - Class headers should include comments documenting non-trivial interfaces. - Don't specify that blocks are preferable to methods as callbacks. - Specify "strong" and "weak" as comments for non-Objective-C pointers. - Replace improper reference to ownership of a retained object. - Clarify some aspects of method ordering rules. - Prefixes are required for shared code and optional for applications. - Clarify that nil pointers are safe as receivers, not necessarily parameters. - Clarify that delegate pointers should typically be zeroing weak pointers. - Allow a 100-column limit, except for projects that choose to use 80. Update Python style guide to 2.59: - Add more examples of bad code to the default arguments section. - Allow ''' when ' is used as the single quote within a file. - Remove references to pychecker. Recommend pylint. - Add more examples to the indentation section. Update JavaScript style guide to 2.93: - Add @nocompile. - Fix a few typos. - When wrapping lines, indent more deeply for child expressions. - Document that @const can be used on a constructor. - Update eval section to discourage using eval for RPC. - Update an example to avoid encouraging using numbers as booleans. - Allow for no indentation of @desc jsdoc tags. - Add @public discussion. Update shell style guide to 1.26: - Add a section on style for case statements. Update Common Lisp style guide to 1.23: - fare-matcher was superseded by optima. - Clarify wording regarding DYNAMIC-EXTENT.
2013-07-12Update C++ style guide to 3.260:mark@chromium.org
- Add boost::bimap to the list of allowed Boost libraries. - C++11: remove mention of constexpr. - Remove noun/verb naming rules, and consolidate "General Naming Rules". - C++11: allow variadic templates. - Revise guidance on function definition comments. - Clarify that one space is sufficient before trailing /* */ comments. - C++11: allow alias templates. - C++11: allow <array>, deprecate Boost array. - C++11: allow unique_ptr, deprecate Boost pointer container. - C++11: allow braced initializer lists. Update Objective-C style guide to 2.56: - Add details on constant declarations to clarify naming and scope issues. - Update link to Apple's Objective-C guide. - Allow left-aligning multi-block method invocation segments. - Add section on container literals. Update Python style guide to 2.54: - Allow str.format in addition to the % operator. - Allow #!/usr/bin/python2 and #!/usr/bin/python3. - Move the closing brace example from column 4 to 0. - Remove the requirement to use named parameters for arguments with defaults. Update HTML/CSS style guide to 2.23: - No changes. Update JavaScript style guide to 2.82: - Fix typos, whitespace, and character entities. - Include property descriptions in the clause about omitting obvious comments. - Make file overviews optional. - Fix example in "HTML in JSDoc" section. - Remove the semicolon-insertion language from the operators section. - State that complete sentences are recommended but not required. - Document usage of goog.scope to declare new classes. Update Common Lisp style guide to 1.20: - Indicate both variable and function predicates require a "p". - Make the abbreviations rules consistent and in one location. - Don't allow for the use of &AUX. - Allow for "body" and "end" as exceptions to the suffix rule. - Use the TODO convention to mark code that needs to be addressed. - Remove file maintainership requirements, require a description. - Change top-level form requirements to the length of a page. - Remove "don't be clever".
2013-03-21Update C++ style guide to 3.245:mark@chromium.org
- Relax the rule for sizeof(varname) vs. sizeof(type). - Allow an exception for nonconst reference parameters where convention dictates their use, such as for swap. - C++11: allow static_assert. - Require non-trivial fall-through between cases in switch statements to be annotated. Trivial fall-through includes consecutive case labels with no intervening code, and no comment is required in these cases. - C++11: allow constexpr. - Revise the "Integer Types" section to note type-width problems. - Clarify that the "arguments on subsequent lines" function call style is acceptable even when the 80-column limit doesn't require it. - Boost: allow part of Polygon. - C++11: allow <tuple>. Update Objective-C style guide to 2.52: - Fix ARC example to not imply the use of @private in .m files. - Add an example to the "Category Names" section. - Require that ARC-using files insert preprocessor directives that generate an error when compiling without ARC. - Fix spacing around the *s in the ARC example per the C++ style guide. Update Python style guide to 2.48: - Allow comments with URLs to exceed 80 characters per line. - Update outdated implicit-line-joining URLs. Update HTML/CSS style guide to 2.21: - Consistent use of title case. - Add new "Declaration Block Separation" section. - Add a CSS example to the "Capitalization" section. - Minor fixes to whitespace. Update JavaScript style to guide to 2.72: - Make it clear that the injunction against aliasing namespaces only applies to local aliases, not goog.scope. - Clarify the style guide's recommendation on array/object literals. - Add documentation on @private {type}, @protected {type}, and @const {type}. - Make JSDoc descriptions required only if not obvious. - Clarify that only private properties and methods need a trailing underscore. - Fix spelling of arv's name. Update Common Lisp style guide to 1.18: - Macro-defining macros are harder to understand for everyone, not just for the "uninitiated." There's no need to condescend. In all of the above style guides: - The guide source is now encoded as UTF-8. The numeric character references have been replaced with raw UTF-8-encoded characters.
2012-11-28Update C++ style guide to 3.231:mark@chromium.org
- Clarify that sentence-like non-sentence comments are permitted. - Note that older code with incorrect #include ordering should be fixed. - Revamp the section on default function arguments. - Avoid explicitly recommending Init() methods. - C++11: permit "auto". - C++11: permit ">>" in place of "> >". - C++11: permit range-based "for". - C++11: permit variadic macros (already permitted as a C++03 extension). - C++11: permit "LL" and "ULL" literal suffixes (already permitted as a C++03 extension). - Reflect the revised copyright and author line policy: copyright notices are not required, but license boilerplate may still be used (and generally contains a copyright notice). Author lines are not required. - C++11: permit new features in <algorithm> and the portion of <numeric> that does not require initializer lists. - Revise rules on forward declarations: explicitly forbid forward-declared functions, do not mandate forward declarations, discourage forward-declared templates. - Remove the rule requiring "const" qualifiers for member functions to be on the same line as the closing parenthesis of the parameter list. - Fix typo: "unnamed namespaces." - C++11: permit local types as template parameters. - Fix typo: "unfamiliar." - Relax RTTI rules to permit its use, but warn about its abuse. - C++11: permit nullptr and nullptr_t. Revise text referring to NULL to refer more generically to null pointers. - Remove the "don't go crazy with const" rule. - Fix typo: "dir/foo2" should bee "dir2/foo2." - Remove reference to a specific GCC version. Update Objective-C style guide to 2.48: - Revise method declaration and invocation formatting rules for long names. - Reflect the revised copyright and author line policy: copyright notices are not required, but license boilerplate may still be used (and generally contains a copyright notice). Author lines are not required. Top-of-file comments are not required. - Fix dead link in the "nil Checks" section. - Cover ARC. - Specify that @private is only required for instance variables in header files. - Permit NSNumber literals. - Change the naming convention for instance variables from trailing underscore to leading underscore, allowing a wide exception for existing code and projects. - Fix description of BOOL with respect to its signedness. Update Python style guide to 2.45: - Recommend "pylint: disable" over "pylint: disable-msg." - Fix case-sensitive anchor. - Provide a better explanation of the problems with catch-all "except:." - Permit "map" and "filter" in absence of inlined lambdas. Update JavaScript style guide to 2.64: - Clarify rules for requiring and providing inner dependencies on classes. - Clarify semicolons for functions. - Note proper namespace and filename casing. - Fix typos: "@extends." - Permit parentheses to be omitted on unions. - Don't require method descriptions when obvious. - "in" is a keyword, put it in <code>. - New "Aliasing with goog.scope" section. - Rewrite the "Constants" section. - Remove the recommendation to use join() to build strings. - Add the "@expose" annotation. - Fix the "@suppress" example. - Remove reference alternate cast syntax. - Reflect the revised copyright and author line policy: copyright notices are not required, but license boilerplate may still be used (and generally contains a copyright notice). Author lines are not required. - Say that "use strict" is not required. - Fix links to "optional" section. - Rewrite "JavaScript Types" section. - Fix typos: "parameterizes," "converted." - Prefer in-constructor field initialization. - Add a section on "delete" and null-assignment. - Add a note about optional JSDoc comments on enum values. - State explicitly that dot operators belong at the ends of lines. - Add "@dict" and "@struct" annotations. - Add links to the JavaScript Types section. - Require (rather than encourage) compiling. Update HTML/CSS style guide to 2.19: - Rephrased quotation guidelines. - Updated W3C I18N article reference. - Fixed revision number. Update styleguide.xsl to 1.34: - Fix error in RefreshVisibilityFromHashParam when a URL fragment points to a named anchor within a section, as used by the JavaScript style guide.
2011-11-04Update C++ style guide to 3.199:mark@chromium.org
- Update an example to omit the blank line between C and C++ #includes. - Rewrite the paragraph about #include ordering. - Clarify namespace closing comments. - Discourage const references for input arguments which are aliased beyond the scope of the function call. - Replace all '&' with '&amp;'. - Clarify that interfaces must have virtual destructors. - Add an explicit example for |else if|. - C++11 updates. Update Objective-C style guide to 2.36: - Remove requirement to list @dynamic implementations. - Remove requirement to never synthesize CFType properties, since they may be retained on 10.6. - Use __weak and __strong type declaration modifiers rather than comments. - Make the copyright/license information consistent. - An example initializer comment revealed too much about the implementation. - Correct spelling mistakes. - Fix names that didn't follow Cocoa conventions. - Fix examples to conform to style. - Add a section about no braces for empty interfaces. - Add a section about automatically synthesized instance variables. - Codify avoidance of accessors in -init and -dealloc methods. - Changes for the 80-column rule. - Weaken the language around object ownership type qualifiers. - Document the rules for formatting blocks. Update JavaScript style guide to 2.27: - Introduce EcmaScript 5 Strict verbiage. - Add a note about private constructors. - Simplify explanations about JSDoc comments. - Sort the JSDoc tags. - Remove the sections about type-checking now that the JSDoc tags and JS types are no longer one table. - Convert <tt> to <code>, because the XSL processor eats <tt>. - Add @suppress. - Mark @inheritDoc deprecated in favor of @override. - Add a section about inner classes and enums being defined in the same file as the top-level class they are defined on. Update Python style guide to 2.28: - Change "Naming" summary to match body. - Make the prohibition against backslash line continuation explicit. - Update the TODO section to match the C++ style guide. - Declare Python code without a shebang line to be stylish. - Clarify rules on function docstrings. - Fix spelling errors. - Update with styleguide.xsl 1.33. Update styleguide.xsl to 1.33: - Clean up style guide JS. - Links to anchor tags auto-expand.
2011-03-29Update C++ style guide to 3.188:mmentovai
- Revise "Smart Pointers" section. - Clarify that it's OK to have spaces after '#' in a preprocessor directive, even though '#' itself must not be indented. - Revise "TODO Comments" section. - Fix wording. - Explicitly recommend foo.h be the first file #included by foo_test.cc. Update Objective-C style guide to 2.24: - Clarify the spacing of @property declarations. - Add "Overridden NSObject Method Placement" section. - Explicitly permit blank lines around @interface, @implementation, and @end. Update JavaScript style guide to 2.20: - Provide additional guidance with respect to the compiler. - Add {function(new:Type)} as a type syntax for constructors of Type. - Revise "Method and Function Comments" section. - Harmonize text and example in the "Passing Anonymous Functions" section. - Explicitly state that @param and @return types must be enclosed in braces. - Add documentation on the UNKNOWN type. - Replace a CODE_SNIPPET with BAD_CODE_SNIPPET in the "Internet Explorer's Conditional Comments" section. - Remove a redundant "Expand for more information" in the "Naming" section and fully spell out "information" in the "Code Formatting" section. - Provide a positive example in the "Multiline string literals" section. - Provide guidance for indentation within nested functions. Update Python style guide to 2.20: - Clarify shebang rule.
2010-11-23Update C++ style guide to 3.180:mmentovai
- Remove comment about naming macros like enums. - Move a bad code snippet from a CODE_SNIPPET to a BAD_CODE_SNIPPET element. Update Python style guide to 2.18: - Clarify the syntax for import statements. Update styleguide.xsl to 1.31: - Substitute underscore for apostrophe in anchor names.
2010-10-14Update C++ style guide to 3.178:mmentovai
- Fix grammatical and spelling errors, and revise awkward phrasing.
2010-10-08Update C++ style guide to 3.175:mmentovai
- Fix typo.
2010-10-04Update C++ style guide to 3.174:mmentovai
- Add leading blank line exception. - Improve guidance for function definition comments. - Tweak class comment example to not violate type naming guidelines. Update Objective-C style guide to 2.21: - Prohibit +new. Update JavaScript style guide to 2.9: - Add new "Function Declarations Within Blocks" section. - Add new "Internet Explorer's Conditional Comments" section. - Add new "Alias long type names to improve readability" section. - Add @lends.
2010-08-10Update C++ style guide to 3.171:mmentovai
- Add a section to specify deprecation comments.
2010-08-05Update C++ style guide to 3.170:mmentovai
- Allow overloading a function judiciously. - _unittest and _regtest are deprecated. - Document C++0x policy. - Allow namespace aliases in .h files when inside namespaces. - Give examples for and against parentheses with return. - Update set of allowed Boost headers. - Add a caveat to the forward-declaration section, mentioning impicit constructors.
2010-05-12Update C++ style guide to 3.161:mmentovai
- Forbid the use of operator synonyms such as "and." - Specify the naming convention (OrDie) to use when a function has crash-on-failure semantics. - Allow static const data members to be non-private. - Specify placement of friend declarations. - Require each file to include headers that they use. Update Objective-C style guide to 2.18: - Prefer @optional to informal protocols when possible. - Specify formatting for invoking methods. - Require that -dealloc be easy to review.
2009-12-03Update C++ style guide to 3.154:mmentovai
- Add call_traits to the set of allowed boost libraries. - Add an exception to the rule against default arguments to cover the useful case of simulating variadic functions. - Discourage the usage of ## in macros. - Clarify example: it's acceptable to declare two parameters on one line even if they don't all fit on that one line. - Fix a typo ("make use symmetric spacing"). - Change bitwise AND to logical AND in a condition. Update styleguide.xsl to 1.27: - Change a bunch of SPANs into DIVs. Update Python style guide to 2.15: - Apply styleguide.xsl 1.27, changing a bunch of SPANs into DIVs.
2009-10-23Update C++ style guide to 3.146:mmentovai
- Make the messaging on DISALLOW_EVIL_CONSTRUCTORS more clear that we should not be rewriting old code but should simply prefer DISALLOW_COPY_AND_ASSIGN on new code. - s/Initializer Lists/Constructor Initializer Lists/ since people search for this based on knowing it's part of the constructor, but forget the precise name. - Allow data members in a test fixture to be private. - Loosen restrictions on globals. - Add explicit guideline for nested namespace formatting. - Strengthen the prohibition against operator overloading for operator&. - Add recommendation for "_" over "-" in file names. - Revise the "Copy Constructors" section for brevity and clarity. Emphasize preference for standard over nonstandard copy operations. - Weaken the wording at the top of the "Doing Work in Constructors" section, making it clear that Init() methods are not absolutely required for non-trivial initialization. - Fix minor typos and grammatical errors. Update Objective-C style guide to 2.14: - Add the Rule of Four for indenting parameters. Allow either of two forms for formatting methods with short first keywords. - Update the guidance on BOOL vs. bool. - Whitespace cleanup. Update Python style guide to 2.14: - Consolidate discussion of the string module, apply, map, filter, and reduce into a single section. - Make it explicit that functions and classes can be nested inside methods.
2009-03-25Update C++ style guide to 3.133:mmentovai
- Clarify that a "very strong convention" is, in fact, only very strong within Google code - Update the style guide with an additional naming possibility for enums: kEnumName - Reword the summary for the section on header file dependencies - Simplify wording regarding static variables Update Objective-C style guide to 2.11: - Provide guidance on when to use #import and #include - Display revision in style guide Update styleguide.xsl with a hint of things to come Set svn:eol-style on xmlstyle.html
2009-01-13Update C++ style guide to 3.127:erg@google.com
- Clarification on curly braces - Link to cpplint.py
2009-01-05Update C++ style guide to 3.124:mmentovai
- Include revision number - Link to google-c-style.el
2008-12-17Update C++ style guide:mmentovai
- Allow unsigned types where defined overflow behavior is desired - Clarify that a function-closing } is permitted on the same line as an opening { for one-line functions Set svn:eol-style = native on google-c-style.el
2008-09-04Update C++ style guide:mmentovai
- 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
2008-07-01Update title and list of approved Boost libraries.mmentovai
2008-06-27Initial public release of the Google C++ Style Guidemmentovai