From b6870cb5db3d6e2edfa0cb2998d2aa4b58b4ac69 Mon Sep 17 00:00:00 2001
From: mmentovai
-Revision 3.161
+Revision 3.170
@@ -178,7 +178,13 @@ Tashana Landray
+ Note that an alias in a .h file is visible to everyone
+ #including that file, so public headers (those available
+ outside a project) and headers transitively #included by them,
+ should avoid defining aliases, as part of the general
+ goal of keeping public APIs as small as possible.
+
+ The C++0x standard is substantialy more complex than its predecessor
+ (1,300 pages versus 800 pages), and is
+ unfamilar to many developers. The long-term effects of some
+ features on code readability and maintenance are unknown. We cannot
+ predict when its various features will be implemented uniformly by
+ tools that may be of interest (gcc, icc, clang, Eclipse, etc.).
+
+ As with Boost, some C++0x extensions encourage
+ 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
+ mechanisms, which may lead to
+ confusion and conversion costs.
+ #include
when a forward declaration
- would suffice.
+ would suffice.
Foo&
.
Foo
.
+ and/or return values, of type Foo
. (One
+ exception is if an argument Foo
+ or const Foo&
has a
+ non-explicit
, one-argument constructor,
+
+ in which case we need the full definition to support
+ automatic type conversion.)
Foo
. This is because static data members
@@ -386,7 +392,7 @@ Tashana Landray
dir/foo.cc
and
dir2/foo2.h
are often in the same
- directory (e.g. base/basictypes_unittest.cc
and
+ directory (e.g. base/basictypes_test.cc
and
base/basictypes.h
), but can be in different
directories too.
.cc
file, and in functions and methods in
- .h
files.
+ .cc
file, anywhere inside the named
+ namespace that wraps an entire .h
file,
+ and in functions and methods.
cpplint.py
- is a tool that reads a source file and
+ is a tool that reads a source file and
identifies many style errors. It is not perfect, and has both false
positives and false negatives, but it is still a valuable tool. False
positives can be ignored by putting // NOLINT
at
@@ -1547,10 +1575,10 @@ Tashana Landray
AppendString()
, AppendInt()
rather
than just Append()
.
+
-
- We are actively considering adding other Boost features to the list, so
- this rule may be relaxed in the future.
+ boost/call_traits.hpp
- boost/compressed_pair.hpp
- boost/ptr_container
except serialization
- boost/array.hpp
- boost/graph
except serialization
- boost/property_map.hpp
- boost/iterator/iterator_adaptor.hpp
,
- boost/iterator/iterator_facade.hpp
, and
- boost/function_output_iterator.hpp
+
+ We are actively considering adding other Boost features to the list, so
+ this rule may be relaxed in the future.
+ boost/call_traits.hpp
+ boost/compressed_pair.hpp
+ boost/ptr_container
except
+ serialization and wrappers for containers not in the C++03
+ standard (ptr_circular_buffer.hpp
and
+ ptr_unordered*
)
+ boost/array.hpp
+ boost/graph
,
+ except serialization (adj_list_serialize.hpp
) and
+ parallel/distributed algorithms and data structures
+ (boost/graph/parallel/*
and
+ boost/graph/distributed/*
).
+ boost/property_map
, except
+ parallel/distributed property maps
+ (boost/property_map/parallel/*
).
+ boost/iterator/iterator_adaptor.hpp
,
+ boost/iterator/iterator_facade.hpp
, and
+ boost/function_output_iterator.hpp
my-useful-class.cc
myusefulclass.cc
+ myusefulclass_test.cc // _unittest and _regtest are deprecated.
@@ -2825,7 +2909,7 @@ Tashana Landray Functions should start with a capital letter and have a capital letter for each new word. No underscores.
-+
If your function crashes upon an error, you should append OrDie to
the function name. This only applies to functions which could be
used by production code and to errors that are reasonably
@@ -3942,15 +4026,23 @@ Tashana Landray
- Return values should not have parentheses:
+ Use parentheses in return
expression with parentheses.
+ Do not needlessly surround the return
expression with
+ parentheses.
return expr;
only where you would use
+ them in x = expr;
.
-Revision 3.161 +Revision 3.170