From Jason Turner

[type.descriptions]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpezyjhko9/{from.md → to.md} +48 -28
tmp/tmpezyjhko9/{from.md → to.md} RENAMED
@@ -1,37 +1,58 @@
1
  #### Type descriptions <a id="type.descriptions">[[type.descriptions]]</a>
2
 
3
  ##### General <a id="type.descriptions.general">[[type.descriptions.general]]</a>
4
 
5
  The Requirements subclauses may describe names that are used to specify
6
- constraints on template arguments.[^7] These names are used in library
7
  Clauses to describe the types that may be supplied as arguments by a
8
  C++program when instantiating template components from the library.
9
 
10
  Certain types defined in Clause  [[input.output]] are used to describe
11
  implementation-defined types. They are based on other types, but with
12
  added constraints.
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ##### Enumerated types <a id="enumerated.types">[[enumerated.types]]</a>
15
 
16
  Several types defined in Clause  [[input.output]] are *enumerated
17
  types*. Each enumerated type may be implemented as an enumeration or as
18
- a synonym for an enumeration.[^8]
19
 
20
- The enumerated type *enumerated* can be written:
21
 
22
  ``` cpp
23
- enum enumerated { V0, V1, V2, V3, ..... };
24
 
25
- static const enumerated C0 (V0);
26
- static const enumerated C1 (V1);
27
- static const enumerated C2 (V2);
28
- static const enumerated C3 (V3);
29
  .....
30
  ```
31
 
32
- Here, the names *C0*, *C1*, etc. represent *enumerated elements* for
33
  this particular enumerated type. All such elements have distinct values.
34
 
35
  ##### Bitmask types <a id="bitmask.types">[[bitmask.types]]</a>
36
 
37
  Several types defined in Clauses  [[language.support]] through 
@@ -41,20 +62,19 @@ operators, as an integer type, or as a `bitset` ([[template.bitset]]).
41
 
42
  The bitmask type *bitmask* can be written:
43
 
44
  ``` cpp
45
  // For exposition only.
46
- // int_type is an integral type capable of
47
- // representing all values of the bitmask type.
48
  enum bitmask : int_type {
49
- V0 = 1 << 0, V1 = 1 << 1, V2 = 1 << 2, V3 = 1 << 3, .....
50
  };
51
 
52
- constexpr bitmask C0(V0{});
53
- constexpr bitmask C1(V1{});
54
- constexpr bitmask C2(V2{});
55
- constexpr bitmask C3(V3{});
56
  .....
57
 
58
  constexpr bitmask{} operator&(bitmask{} X, bitmask{} Y) {
59
  return static_cast<bitmask{}>(
60
  static_cast<int_type>(X) & static_cast<int_type>(Y));
@@ -79,14 +99,14 @@ bitmask{}& operator|=(bitmask{}& X, bitmask{} Y) {
79
  bitmask{}& operator^=(bitmask{}& X, bitmask{} Y) {
80
  X = X ^ Y; return X;
81
  }
82
  ```
83
 
84
- Here, the names *C0*, *C1*, etc. represent *bitmask elements* for this
85
  particular bitmask type. All such elements have distinct, nonzero values
86
- such that, for any pair *Ci* and *Cj* where *i* != *j*, *Ci* & *Ci* is
87
- nonzero and *Ci* & *Cj* is zero. Additionally, the value 0 is used to
88
  represent an *empty bitmask*, in which no bitmask elements are set.
89
 
90
  The following terms apply to objects and values of bitmask types:
91
 
92
  - To *set* a value *Y* in an object *X* is to evaluate the expression
@@ -100,46 +120,46 @@ The following terms apply to objects and values of bitmask types:
100
 
101
  The C standard library makes widespread use of characters and character
102
  sequences that follow a few uniform conventions:
103
 
104
  - A *letter* is any of the 26 lowercase or 26 uppercase letters in the
105
- basic execution character set.[^9]
106
  - The *decimal-point character* is the (single-byte) character used by
107
  functions that convert between a (single-byte) character sequence and
108
  a value of one of the floating-point types. It is used in the
109
  character sequence to denote the beginning of a fractional part. It is
110
  represented in Clauses  [[language.support]] through  [[thread]] and
111
  Annex  [[depr]] by a period, `'.'`, which is also its value in the
112
  `"C"` locale, but may change during program execution by a call to
113
- `setlocale(int, const char*)`,[^10] or by a change to a `locale`
114
  object, as described in Clauses  [[locales]] and  [[input.output]].
115
- - A *character sequence* is an array object ([[dcl.array]]) *A* that
116
- can be declared as `T A[N]`, where *T* is any of the types `char`,
117
  `unsigned char`, or `signed char` ([[basic.fundamental]]), optionally
118
  qualified by any combination of `const` or `volatile`. The initial
119
  elements of the array have defined contents up to and including an
120
  element determined by some predicate. A character sequence can be
121
- designated by a pointer value *S* that points to its first element.
122
 
123
  ###### Byte strings <a id="byte.strings">[[byte.strings]]</a>
124
 
125
  A *null-terminated byte string*, or NTBS, is a character sequence whose
126
  highest-addressed element with defined content has the value zero (the
127
  *terminating null* character); no other element in the sequence has the
128
- value zero. [^11]
129
 
130
  The *length* of an NTBS is the number of elements that precede the
131
  terminating null character. An *empty* NTBS has a length of zero.
132
 
133
  The *value* of an NTBS is the sequence of values of the elements up to
134
  and including the terminating null character.
135
 
136
- A *static* NTBS is an NTBSwith static storage duration.[^12]
137
 
138
  ###### Multibyte strings <a id="multibyte.strings">[[multibyte.strings]]</a>
139
 
140
- A *null-terminated multibyte string,* or NTMBS, is an NTBSthat
141
  constitutes a sequence of valid multibyte characters, beginning and
142
- ending in the initial shift state.[^13]
143
 
144
  A *static* NTMBS is an NTMBSwith static storage duration.
145
 
 
1
  #### Type descriptions <a id="type.descriptions">[[type.descriptions]]</a>
2
 
3
  ##### General <a id="type.descriptions.general">[[type.descriptions.general]]</a>
4
 
5
  The Requirements subclauses may describe names that are used to specify
6
+ constraints on template arguments.[^6] These names are used in library
7
  Clauses to describe the types that may be supplied as arguments by a
8
  C++program when instantiating template components from the library.
9
 
10
  Certain types defined in Clause  [[input.output]] are used to describe
11
  implementation-defined types. They are based on other types, but with
12
  added constraints.
13
 
14
+ ##### Exposition-only types <a id="expos.only.types">[[expos.only.types]]</a>
15
+
16
+ Several types defined in Clauses  [[language.support]] through 
17
+ [[thread]] and Annex  [[depr]] that are used as function parameter or
18
+ return types are defined for the purpose of exposition only in order to
19
+ capture their language linkage. The declarations of such types are
20
+ followed by a comment ending in *exposition only*.
21
+
22
+ [*Example 1*:
23
+
24
+ ``` cpp
25
+ namespace std {
26
+ extern "C" using some-handler = int(int, void*, double); // exposition only
27
+ }
28
+ ```
29
+
30
+ The type placeholder `some-handler` can now be used to specify a
31
+ function that takes a callback parameter with C language linkage.
32
+
33
+ — *end example*]
34
+
35
  ##### Enumerated types <a id="enumerated.types">[[enumerated.types]]</a>
36
 
37
  Several types defined in Clause  [[input.output]] are *enumerated
38
  types*. Each enumerated type may be implemented as an enumeration or as
39
+ a synonym for an enumeration.[^7]
40
 
41
+ The enumerated type `enumerated` can be written:
42
 
43
  ``` cpp
44
+ enum enumerated { V₀, V₁, V₂, V₃, ..... };
45
 
46
+ inline const enumerated C₀(V₀);
47
+ inline const enumerated C₁(V₁);
48
+ inline const enumerated C₂(V₂);
49
+ inline const enumerated C₃(V₃);
50
  .....
51
  ```
52
 
53
+ Here, the names `C₀`, `C₁`, etc. represent *enumerated elements* for
54
  this particular enumerated type. All such elements have distinct values.
55
 
56
  ##### Bitmask types <a id="bitmask.types">[[bitmask.types]]</a>
57
 
58
  Several types defined in Clauses  [[language.support]] through 
 
62
 
63
  The bitmask type *bitmask* can be written:
64
 
65
  ``` cpp
66
  // For exposition only.
67
+ // int_type is an integral type capable of representing all values of the bitmask type.
 
68
  enum bitmask : int_type {
69
+ V₀ = 1 << 0, V₁ = 1 << 1, V₂ = 1 << 2, V₃ = 1 << 3, .....
70
  };
71
 
72
+ inline constexpr bitmask C₀(V₀{});
73
+ inline constexpr bitmask C₁(V₁{});
74
+ inline constexpr bitmask C₂(V₂{});
75
+ inline constexpr bitmask C₃(V₃{});
76
  .....
77
 
78
  constexpr bitmask{} operator&(bitmask{} X, bitmask{} Y) {
79
  return static_cast<bitmask{}>(
80
  static_cast<int_type>(X) & static_cast<int_type>(Y));
 
99
  bitmask{}& operator^=(bitmask{}& X, bitmask{} Y) {
100
  X = X ^ Y; return X;
101
  }
102
  ```
103
 
104
+ Here, the names `C₀`, `C₁`, etc. represent *bitmask elements* for this
105
  particular bitmask type. All such elements have distinct, nonzero values
106
+ such that, for any pair `Cᵢ` and `Cⱼ` where i j, `C_i & C_i` is
107
+ nonzero and `C_i & C_j` is zero. Additionally, the value `0` is used to
108
  represent an *empty bitmask*, in which no bitmask elements are set.
109
 
110
  The following terms apply to objects and values of bitmask types:
111
 
112
  - To *set* a value *Y* in an object *X* is to evaluate the expression
 
120
 
121
  The C standard library makes widespread use of characters and character
122
  sequences that follow a few uniform conventions:
123
 
124
  - A *letter* is any of the 26 lowercase or 26 uppercase letters in the
125
+ basic execution character set.
126
  - The *decimal-point character* is the (single-byte) character used by
127
  functions that convert between a (single-byte) character sequence and
128
  a value of one of the floating-point types. It is used in the
129
  character sequence to denote the beginning of a fractional part. It is
130
  represented in Clauses  [[language.support]] through  [[thread]] and
131
  Annex  [[depr]] by a period, `'.'`, which is also its value in the
132
  `"C"` locale, but may change during program execution by a call to
133
+ `setlocale(int, const char*)`,[^8] or by a change to a `locale`
134
  object, as described in Clauses  [[locales]] and  [[input.output]].
135
+ - A *character sequence* is an array object ([[dcl.array]]) `A` that
136
+ can be declared as `T A[N]`, where `T` is any of the types `char`,
137
  `unsigned char`, or `signed char` ([[basic.fundamental]]), optionally
138
  qualified by any combination of `const` or `volatile`. The initial
139
  elements of the array have defined contents up to and including an
140
  element determined by some predicate. A character sequence can be
141
+ designated by a pointer value `S` that points to its first element.
142
 
143
  ###### Byte strings <a id="byte.strings">[[byte.strings]]</a>
144
 
145
  A *null-terminated byte string*, or NTBS, is a character sequence whose
146
  highest-addressed element with defined content has the value zero (the
147
  *terminating null* character); no other element in the sequence has the
148
+ value zero. [^9]
149
 
150
  The *length* of an NTBS is the number of elements that precede the
151
  terminating null character. An *empty* NTBS has a length of zero.
152
 
153
  The *value* of an NTBS is the sequence of values of the elements up to
154
  and including the terminating null character.
155
 
156
+ A *static* NTBS is an NTBSwith static storage duration.[^10]
157
 
158
  ###### Multibyte strings <a id="multibyte.strings">[[multibyte.strings]]</a>
159
 
160
+ A *null-terminated multibyte string*, or NTMBS, is an NTBSthat
161
  constitutes a sequence of valid multibyte characters, beginning and
162
+ ending in the initial shift state.[^11]
163
 
164
  A *static* NTMBS is an NTMBSwith static storage duration.
165