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 Landraydir2/foo2.h
(preferred location
- — see details below)..h
files.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
+
You should not use the unsigned integer types such as
+ 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.
+
+
- Use
const
whenever it makes sense.
+ With C++11,
+ constexpr
is a better choice for some uses of const.
constexpr
+ to define true constants or to ensure constant initialization.
+ 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.
+ 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.
+ 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.
+ <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.
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.
sizeof(varname)
instead of
- sizeof(type)
whenever possible.
+ Prefer sizeof(varname)
to
+ sizeof(type)
.
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.
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
+ boost/polygon/voronoi_builder.hpp
,
+ boost/polygon/voronoi_diagram.hpp
, and
+ boost/polygon/voronoi_geometry_type.hpp
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).>>
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.nullptr
and nullptr_t
.static_assert
.- 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:
+ 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{}
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
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.
- Don’t use tabs or mix tabs and spaces for indentation. + Don’t use tabs or mix tabs and spaces for indentation.
- 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).
TODO
.
<!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 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 @@
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).