tmp/tmps6b2g73e/{from.md → to.md}
RENAMED
|
@@ -1,15 +1,35 @@
|
|
| 1 |
## C library locales <a id="c.locales">[[c.locales]]</a>
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
Calls to the function `setlocale` may introduce a data race (
|
| 8 |
[[res.on.data.races]]) with other calls to `setlocale` or with calls to
|
| 9 |
the functions listed in Table [[tab:setlocale.data.races]].
|
| 10 |
|
|
|
|
|
|
|
| 11 |
**Table: Potential `setlocale` data races** <a id="tab:setlocale.data.races">[tab:setlocale.data.races]</a>
|
| 12 |
|
| 13 |
| | | | | |
|
| 14 |
| --------- | ---------- | ----------- | ------------ | ---------- |
|
| 15 |
| `fprintf` | `isprint` | `iswdigit` | `localeconv` | `tolower` |
|
|
@@ -21,31 +41,29 @@ the functions listed in Table [[tab:setlocale.data.races]].
|
|
| 21 |
| `isdigit` | `iswblank` | `iswupper` | `strerror` | `wcstombs` |
|
| 22 |
| `isgraph` | `iswcntrl` | `iswxdigit` | `strtod` | `wcsxfrm` |
|
| 23 |
| `islower` | `iswctype` | `isxdigit` | `strxfrm` | `wctomb` |
|
| 24 |
|
| 25 |
|
| 26 |
-
ISO C Clause 7.4.
|
| 27 |
|
| 28 |
<!-- Link reference definitions -->
|
| 29 |
[alg.lex.comparison]: algorithms.md#alg.lex.comparison
|
| 30 |
[alg.sort]: algorithms.md#alg.sort
|
| 31 |
[algorithms]: algorithms.md#algorithms
|
| 32 |
-
[basic.start.
|
| 33 |
[bitmask.types]: library.md#bitmask.types
|
| 34 |
[c.files]: input.md#c.files
|
| 35 |
[c.locales]: #c.locales
|
| 36 |
[category.collate]: #category.collate
|
| 37 |
[category.ctype]: #category.ctype
|
| 38 |
[category.messages]: #category.messages
|
| 39 |
[category.monetary]: #category.monetary
|
| 40 |
[category.numeric]: #category.numeric
|
| 41 |
[category.time]: #category.time
|
| 42 |
[classification]: #classification
|
|
|
|
| 43 |
[conversions]: #conversions
|
| 44 |
-
[conversions.buffer]: #conversions.buffer
|
| 45 |
[conversions.character]: #conversions.character
|
| 46 |
-
[conversions.string]: #conversions.string
|
| 47 |
[facet.ctype.char.dtor]: #facet.ctype.char.dtor
|
| 48 |
[facet.ctype.char.members]: #facet.ctype.char.members
|
| 49 |
[facet.ctype.char.statics]: #facet.ctype.char.statics
|
| 50 |
[facet.ctype.char.virtuals]: #facet.ctype.char.virtuals
|
| 51 |
[facet.ctype.special]: #facet.ctype.special
|
|
@@ -102,11 +120,10 @@ ISO C Clause 7.4.
|
|
| 102 |
[locale.num.get]: #locale.num.get
|
| 103 |
[locale.numpunct]: #locale.numpunct
|
| 104 |
[locale.numpunct.byname]: #locale.numpunct.byname
|
| 105 |
[locale.operators]: #locale.operators
|
| 106 |
[locale.statics]: #locale.statics
|
| 107 |
-
[locale.stdcvt]: #locale.stdcvt
|
| 108 |
[locale.syn]: #locale.syn
|
| 109 |
[locale.time.get]: #locale.time.get
|
| 110 |
[locale.time.get.byname]: #locale.time.get.byname
|
| 111 |
[locale.time.get.members]: #locale.time.get.members
|
| 112 |
[locale.time.get.virtuals]: #locale.time.get.virtuals
|
|
@@ -123,11 +140,10 @@ ISO C Clause 7.4.
|
|
| 123 |
[sequence.reqmts]: containers.md#sequence.reqmts
|
| 124 |
[tab:lib.locale.time.get.virtuals.dogetdate]: #tab:lib.locale.time.get.virtuals.dogetdate
|
| 125 |
[tab:localization.category.facets]: #tab:localization.category.facets
|
| 126 |
[tab:localization.convert.result.values.out.in]: #tab:localization.convert.result.values.out.in
|
| 127 |
[tab:localization.convert.result.values.unshift]: #tab:localization.convert.result.values.unshift
|
| 128 |
-
[tab:localization.hdr.clocale]: #tab:localization.hdr.clocale
|
| 129 |
[tab:localization.lib.summary]: #tab:localization.lib.summary
|
| 130 |
[tab:localization.required.specializations]: #tab:localization.required.specializations
|
| 131 |
[tab:setlocale.data.races]: #tab:setlocale.data.races
|
| 132 |
[vector]: containers.md#vector
|
| 133 |
|
|
@@ -135,85 +151,89 @@ ISO C Clause 7.4.
|
|
| 135 |
that is defined in `<ctime>`.
|
| 136 |
|
| 137 |
[^2]: Note that in the call to `put` the stream is implicitly converted
|
| 138 |
to an `ostreambuf_iterator<charT, traits>`.
|
| 139 |
|
| 140 |
-
[^3]:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
use it directly, or use the vector form of `ctype<>::is`.
|
| 142 |
|
| 143 |
-
[^
|
| 144 |
derived from character literals for conversion to the locale’s
|
| 145 |
encoding.
|
| 146 |
|
| 147 |
-
[^
|
| 148 |
character classification that `c` is not also a member of.
|
| 149 |
|
| 150 |
-
[^
|
| 151 |
provided. The specialization is specified in the standard, and not
|
| 152 |
left as an implementation detail, because it affects the derivation
|
| 153 |
interface for `ctype<char>`.
|
| 154 |
|
| 155 |
-
[^
|
| 156 |
mappings from internal to external characters is 1 to N: a `codecvt`
|
| 157 |
facet that is used by `basic_filebuf` must be able to translate
|
| 158 |
characters one internal character at a time.
|
| 159 |
|
| 160 |
-
[^
|
| 161 |
-
`stateT()`
|
| 162 |
|
| 163 |
-
[^
|
| 164 |
-
elements may be consumed when producing a single `internT`
|
| 165 |
character, and additional `externT` elements may appear at the end
|
| 166 |
of a sequence after those that yield the final `internT` character.
|
| 167 |
|
| 168 |
-
[^
|
| 169 |
that the corresponding member `get()` at least extract the sign
|
| 170 |
before delegating.
|
| 171 |
|
| 172 |
-
[^
|
| 173 |
is *not* a padding character.
|
| 174 |
|
| 175 |
-
[^
|
| 176 |
`"3"` probably indicates groups of 51 (!) digits each, because 51 is
|
| 177 |
the ASCII value of `"3"`.
|
| 178 |
|
| 179 |
-
[^
|
| 180 |
other strings.
|
| 181 |
|
| 182 |
-
[^
|
| 183 |
parsing of user-entered dates and times, but machine-generated
|
| 184 |
formats can be parsed reliably. This allows parsers to be aggressive
|
| 185 |
about interpreting user variations on standard formats.
|
| 186 |
|
| 187 |
-
[^
|
| 188 |
formats, and may return `no_order` in valid locales.
|
| 189 |
|
| 190 |
-
[^
|
| 191 |
vendors do.
|
| 192 |
|
| 193 |
-
[^
|
| 194 |
implementation-defined, but should follow POSIX conventions.
|
| 195 |
|
| 196 |
-
[^
|
| 197 |
as POSIX for these definitions.
|
| 198 |
|
| 199 |
-
[^
|
| 200 |
|
| 201 |
-
[^
|
| 202 |
for `pattern::field` purely for efficiency.
|
| 203 |
|
| 204 |
-
[^
|
| 205 |
|
| 206 |
-
[^
|
| 207 |
|
| 208 |
-
[^
|
| 209 |
|
| 210 |
-
[^
|
| 211 |
`true`) this is typically four characters long, usually three
|
| 212 |
letters and a space.
|
| 213 |
|
| 214 |
-
[^
|
| 215 |
|
| 216 |
-
[^
|
| 217 |
|
| 218 |
-
[^
|
| 219 |
usually contains a space, itself; for example, `"USD "`.
|
|
|
|
| 1 |
## C library locales <a id="c.locales">[[c.locales]]</a>
|
| 2 |
|
| 3 |
+
### Header `<clocale>` synopsis <a id="clocale.syn">[[clocale.syn]]</a>
|
| 4 |
|
| 5 |
+
``` cpp
|
| 6 |
+
namespace std {
|
| 7 |
+
struct lconv;
|
| 8 |
+
|
| 9 |
+
char* setlocale(int category, const char* locale);
|
| 10 |
+
lconv* localeconv();
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
#define NULL see [support.types.nullptr]
|
| 14 |
+
#define LC_ALL see below
|
| 15 |
+
#define LC_COLLATE see below
|
| 16 |
+
#define LC_CTYPE see below
|
| 17 |
+
#define LC_MONETARY see below
|
| 18 |
+
#define LC_NUMERIC see below
|
| 19 |
+
#define LC_TIME see below
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
The contents and meaning of the header `<clocale>` are the same as the C
|
| 23 |
+
standard library header `<locale.h>`.
|
| 24 |
|
| 25 |
Calls to the function `setlocale` may introduce a data race (
|
| 26 |
[[res.on.data.races]]) with other calls to `setlocale` or with calls to
|
| 27 |
the functions listed in Table [[tab:setlocale.data.races]].
|
| 28 |
|
| 29 |
+
ISO C 7.11.
|
| 30 |
+
|
| 31 |
**Table: Potential `setlocale` data races** <a id="tab:setlocale.data.races">[tab:setlocale.data.races]</a>
|
| 32 |
|
| 33 |
| | | | | |
|
| 34 |
| --------- | ---------- | ----------- | ------------ | ---------- |
|
| 35 |
| `fprintf` | `isprint` | `iswdigit` | `localeconv` | `tolower` |
|
|
|
|
| 41 |
| `isdigit` | `iswblank` | `iswupper` | `strerror` | `wcstombs` |
|
| 42 |
| `isgraph` | `iswcntrl` | `iswxdigit` | `strtod` | `wcsxfrm` |
|
| 43 |
| `islower` | `iswctype` | `isxdigit` | `strxfrm` | `wctomb` |
|
| 44 |
|
| 45 |
|
|
|
|
| 46 |
|
| 47 |
<!-- Link reference definitions -->
|
| 48 |
[alg.lex.comparison]: algorithms.md#alg.lex.comparison
|
| 49 |
[alg.sort]: algorithms.md#alg.sort
|
| 50 |
[algorithms]: algorithms.md#algorithms
|
| 51 |
+
[basic.start.static]: basic.md#basic.start.static
|
| 52 |
[bitmask.types]: library.md#bitmask.types
|
| 53 |
[c.files]: input.md#c.files
|
| 54 |
[c.locales]: #c.locales
|
| 55 |
[category.collate]: #category.collate
|
| 56 |
[category.ctype]: #category.ctype
|
| 57 |
[category.messages]: #category.messages
|
| 58 |
[category.monetary]: #category.monetary
|
| 59 |
[category.numeric]: #category.numeric
|
| 60 |
[category.time]: #category.time
|
| 61 |
[classification]: #classification
|
| 62 |
+
[clocale.syn]: #clocale.syn
|
| 63 |
[conversions]: #conversions
|
|
|
|
| 64 |
[conversions.character]: #conversions.character
|
|
|
|
| 65 |
[facet.ctype.char.dtor]: #facet.ctype.char.dtor
|
| 66 |
[facet.ctype.char.members]: #facet.ctype.char.members
|
| 67 |
[facet.ctype.char.statics]: #facet.ctype.char.statics
|
| 68 |
[facet.ctype.char.virtuals]: #facet.ctype.char.virtuals
|
| 69 |
[facet.ctype.special]: #facet.ctype.special
|
|
|
|
| 120 |
[locale.num.get]: #locale.num.get
|
| 121 |
[locale.numpunct]: #locale.numpunct
|
| 122 |
[locale.numpunct.byname]: #locale.numpunct.byname
|
| 123 |
[locale.operators]: #locale.operators
|
| 124 |
[locale.statics]: #locale.statics
|
|
|
|
| 125 |
[locale.syn]: #locale.syn
|
| 126 |
[locale.time.get]: #locale.time.get
|
| 127 |
[locale.time.get.byname]: #locale.time.get.byname
|
| 128 |
[locale.time.get.members]: #locale.time.get.members
|
| 129 |
[locale.time.get.virtuals]: #locale.time.get.virtuals
|
|
|
|
| 140 |
[sequence.reqmts]: containers.md#sequence.reqmts
|
| 141 |
[tab:lib.locale.time.get.virtuals.dogetdate]: #tab:lib.locale.time.get.virtuals.dogetdate
|
| 142 |
[tab:localization.category.facets]: #tab:localization.category.facets
|
| 143 |
[tab:localization.convert.result.values.out.in]: #tab:localization.convert.result.values.out.in
|
| 144 |
[tab:localization.convert.result.values.unshift]: #tab:localization.convert.result.values.unshift
|
|
|
|
| 145 |
[tab:localization.lib.summary]: #tab:localization.lib.summary
|
| 146 |
[tab:localization.required.specializations]: #tab:localization.required.specializations
|
| 147 |
[tab:setlocale.data.races]: #tab:setlocale.data.races
|
| 148 |
[vector]: containers.md#vector
|
| 149 |
|
|
|
|
| 151 |
that is defined in `<ctime>`.
|
| 152 |
|
| 153 |
[^2]: Note that in the call to `put` the stream is implicitly converted
|
| 154 |
to an `ostreambuf_iterator<charT, traits>`.
|
| 155 |
|
| 156 |
+
[^3]: This is a complete list of requirements; there are no other
|
| 157 |
+
requirements. Thus, a facet class need not have a public copy
|
| 158 |
+
constructor, assignment, default constructor, destructor, etc.
|
| 159 |
+
|
| 160 |
+
[^4]: When used in a loop, it is faster to cache the `ctype<>` facet and
|
| 161 |
use it directly, or use the vector form of `ctype<>::is`.
|
| 162 |
|
| 163 |
+
[^5]: The char argument of `do_widen` is intended to accept values
|
| 164 |
derived from character literals for conversion to the locale’s
|
| 165 |
encoding.
|
| 166 |
|
| 167 |
+
[^6]: In other words, the transformed character is not a member of any
|
| 168 |
character classification that `c` is not also a member of.
|
| 169 |
|
| 170 |
+
[^7]: Only the `char` (not `unsigned char` and `signed char`) form is
|
| 171 |
provided. The specialization is specified in the standard, and not
|
| 172 |
left as an implementation detail, because it affects the derivation
|
| 173 |
interface for `ctype<char>`.
|
| 174 |
|
| 175 |
+
[^8]: Informally, this means that `basic_filebuf` assumes that the
|
| 176 |
mappings from internal to external characters is 1 to N: a `codecvt`
|
| 177 |
facet that is used by `basic_filebuf` must be able to translate
|
| 178 |
characters one internal character at a time.
|
| 179 |
|
| 180 |
+
[^9]: Typically these will be characters to return the state to
|
| 181 |
+
`stateT()`.
|
| 182 |
|
| 183 |
+
[^10]: If `encoding()` yields `-1`, then more than `max_length()`
|
| 184 |
+
`externT` elements may be consumed when producing a single `internT`
|
| 185 |
character, and additional `externT` elements may appear at the end
|
| 186 |
of a sequence after those that yield the final `internT` character.
|
| 187 |
|
| 188 |
+
[^11]: Parsing `"-1"` correctly into, e.g., an `unsigned short` requires
|
| 189 |
that the corresponding member `get()` at least extract the sign
|
| 190 |
before delegating.
|
| 191 |
|
| 192 |
+
[^12]: The conversion specification `#o` generates a leading `0` which
|
| 193 |
is *not* a padding character.
|
| 194 |
|
| 195 |
+
[^13]: Thus, the string `"\003"` specifies groups of 3 digits each, and
|
| 196 |
`"3"` probably indicates groups of 51 (!) digits each, because 51 is
|
| 197 |
the ASCII value of `"3"`.
|
| 198 |
|
| 199 |
+
[^14]: This function is useful when one string is being compared to many
|
| 200 |
other strings.
|
| 201 |
|
| 202 |
+
[^15]: In other words, user confirmation is required for reliable
|
| 203 |
parsing of user-entered dates and times, but machine-generated
|
| 204 |
formats can be parsed reliably. This allows parsers to be aggressive
|
| 205 |
about interpreting user variations on standard formats.
|
| 206 |
|
| 207 |
+
[^16]: This function is intended as a convenience only, for common
|
| 208 |
formats, and may return `no_order` in valid locales.
|
| 209 |
|
| 210 |
+
[^17]: Although the C programming language defines no modifiers, most
|
| 211 |
vendors do.
|
| 212 |
|
| 213 |
+
[^18]: Interpretation of the `modifier` argument is
|
| 214 |
implementation-defined, but should follow POSIX conventions.
|
| 215 |
|
| 216 |
+
[^19]: Implementations are encouraged to refer to other standards such
|
| 217 |
as POSIX for these definitions.
|
| 218 |
|
| 219 |
+
[^20]: The semantics here are different from `ct.narrow`.
|
| 220 |
|
| 221 |
+
[^21]: An array of `char`, rather than an array of `part`, is specified
|
| 222 |
for `pattern::field` purely for efficiency.
|
| 223 |
|
| 224 |
+
[^22]: In common U.S. locales this is `’.’`.
|
| 225 |
|
| 226 |
+
[^23]: In common U.S. locales this is `’,’`.
|
| 227 |
|
| 228 |
+
[^24]: To specify grouping by 3s, the value is `"\003"` *not* `"3"`.
|
| 229 |
|
| 230 |
+
[^25]: For international specializations (second template parameter
|
| 231 |
`true`) this is typically four characters long, usually three
|
| 232 |
letters and a space.
|
| 233 |
|
| 234 |
+
[^26]: This is usually the empty string.
|
| 235 |
|
| 236 |
+
[^27]: In common U.S. locales, this is 2.
|
| 237 |
|
| 238 |
+
[^28]: Note that the international symbol returned by `do_curr_sym()`
|
| 239 |
usually contains a space, itself; for example, `"USD "`.
|