From Jason Turner

[expr.sizeof]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpdvfft_a3/{from.md → to.md} +20 -13
tmp/tmpdvfft_a3/{from.md → to.md} RENAMED
@@ -1,33 +1,40 @@
1
  #### Sizeof <a id="expr.sizeof">[[expr.sizeof]]</a>
2
 
3
  The `sizeof` operator yields the number of bytes occupied by a
4
  non-potentially-overlapping object of the type of its operand. The
5
  operand is either an expression, which is an unevaluated operand
6
- [[expr.prop]], or a parenthesized *type-id*. The `sizeof` operator shall
7
- not be applied to an expression that has function or incomplete type, to
8
- the parenthesized name of such types, or to a glvalue that designates a
9
- bit-field. The result of `sizeof` applied to any of the narrow character
10
- types is `1`. The result of `sizeof` applied to any other fundamental
11
- type [[basic.fundamental]] is *implementation-defined*.
 
12
 
13
- [*Note 1*: In particular, `sizeof(bool)`, `sizeof(char16_t)`,
 
 
14
  `sizeof(char32_t)`, and `sizeof(wchar_t)` are
15
- implementation-defined.[^21] — *end note*]
 
 
16
 
17
  [*Note 2*: See  [[intro.memory]] for the definition of byte and 
18
- [[basic.types]] for the definition of object
19
  representation. — *end note*]
20
 
21
  When applied to a reference type, the result is the size of the
22
  referenced type. When applied to a class, the result is the number of
23
  bytes in an object of that class including any padding required for
24
  placing objects of that type in an array. The result of applying
25
  `sizeof` to a potentially-overlapping subobject is the size of the type,
26
- not the size of the subobject. [^22] When applied to an array, the
27
- result is the total number of bytes in the array. This implies that the
28
- size of an array of n elements is n times the size of an element.
 
 
29
 
30
  The lvalue-to-rvalue [[conv.lval]], array-to-pointer [[conv.array]], and
31
  function-to-pointer [[conv.func]] standard conversions are not applied
32
  to the operand of `sizeof`. If the operand is a prvalue, the temporary
33
  materialization conversion [[conv.rval]] is applied.
@@ -51,7 +58,7 @@ struct count {
51
  The result of `sizeof` and `sizeof...` is a prvalue of type
52
  `std::size_t`.
53
 
54
  [*Note 3*: A `sizeof` expression is an integral constant expression
55
  [[expr.const]]. The type `std::size_t` is defined in the standard header
56
- `<cstddef>` ([[cstddef.syn]], [[support.types.layout]]). — *end note*]
57
 
 
1
  #### Sizeof <a id="expr.sizeof">[[expr.sizeof]]</a>
2
 
3
  The `sizeof` operator yields the number of bytes occupied by a
4
  non-potentially-overlapping object of the type of its operand. The
5
  operand is either an expression, which is an unevaluated operand
6
+ [[term.unevaluated.operand]], or a parenthesized *type-id*. The `sizeof`
7
+ operator shall not be applied to an expression that has function or
8
+ incomplete type, to the parenthesized name of such types, or to a
9
+ glvalue that designates a bit-field. The result of `sizeof` applied to
10
+ any of the narrow character types is `1`. The result of `sizeof` applied
11
+ to any other fundamental type [[basic.fundamental]] is
12
+ *implementation-defined*.
13
 
14
+ [*Note 1*:
15
+
16
+ In particular, the values of `sizeof(bool)`, `sizeof(char16_t)`,
17
  `sizeof(char32_t)`, and `sizeof(wchar_t)` are
18
+ implementation-defined.[^21]
19
+
20
+ — *end note*]
21
 
22
  [*Note 2*: See  [[intro.memory]] for the definition of byte and 
23
+ [[term.object.representation]] for the definition of object
24
  representation. — *end note*]
25
 
26
  When applied to a reference type, the result is the size of the
27
  referenced type. When applied to a class, the result is the number of
28
  bytes in an object of that class including any padding required for
29
  placing objects of that type in an array. The result of applying
30
  `sizeof` to a potentially-overlapping subobject is the size of the type,
31
+ not the size of the subobject.[^22]
32
+
33
+ When applied to an array, the result is the total number of bytes in the
34
+ array. This implies that the size of an array of n elements is n times
35
+ the size of an element.
36
 
37
  The lvalue-to-rvalue [[conv.lval]], array-to-pointer [[conv.array]], and
38
  function-to-pointer [[conv.func]] standard conversions are not applied
39
  to the operand of `sizeof`. If the operand is a prvalue, the temporary
40
  materialization conversion [[conv.rval]] is applied.
 
58
  The result of `sizeof` and `sizeof...` is a prvalue of type
59
  `std::size_t`.
60
 
61
  [*Note 3*: A `sizeof` expression is an integral constant expression
62
  [[expr.const]]. The type `std::size_t` is defined in the standard header
63
+ `<cstddef>` [[cstddef.syn]], [[support.types.layout]]. — *end note*]
64