Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/string/multibyte/mbstate t"

From cppreference.com
< cpp‎ | string‎ | multibyte
m (-"c library")
m (NULL => a null pointer)
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{cpp/title|mbstate_t}}
 
{{cpp/title|mbstate_t}}
{{cpp/string/multibyte/sidebar}}
+
{{cpp/string/multibyte/navbar}}
{{ddcl | header=cwchar |
+
{{dcl begin}}
struct mbstate_t;
+
{{dcl header | cuchar | notes={{mark since c++17}}}}
}}
+
{{dcl header | cwchar }}
 +
{{dcl | struct mbstate_t; }}
 +
{{dcl end}}
  
 
The type mbstate_t is a trivial non-array type that can represent any of the conversion states that can occur in an implementation-defined set of supported multibyte character encoding rules. Zero-initialized value of {{tt|mbstate_t}} represents the initial conversion state, although other values of {{tt|mbstate_t}} may exist that also represent the initial conversion state.
 
The type mbstate_t is a trivial non-array type that can represent any of the conversion states that can occur in an implementation-defined set of supported multibyte character encoding rules. Zero-initialized value of {{tt|mbstate_t}} represents the initial conversion state, although other values of {{tt|mbstate_t}} may exist that also represent the initial conversion state.
  
Possible implementation of {{tt|mbstate_t}} is a struct type holding an array representing the incomplete multibyte character and an integer counter indicating the number of bytes in the array that have been processed.  
+
Possible implementation of {{tt|mbstate_t}} is a struct type holding an array representing the incomplete multibyte character, an integer counter indicating the number of bytes in the array that have been processed, and a representation of the current shift state.
  
The following functions cannot not be called simultaneously from multiple threads with the {{cpp|std::mbstate_t*}} argument of {{tt|NULL}} due to possible data races: {{cpp|std::mbrlen}}, {{cpp|std::mbrtowc}}, {{cpp|std::mbsrtowc}}, {{cpp|std::mbtowc}}, {{cpp|std::wcrtomb}}, {{cpp|std::wcsrtomb}}, {{cpp|std::wctomb}}.  
+
The following functions should not be called from multiple threads without synchronization with the {{c|std::mbstate_t*}} argument of a null pointer due to possible data races: {{lc|std::mbrlen}}, {{lc|std::mbrtowc}}, {{lc|std::mbsrtowcs}}, {{lc|std::mbtowc}}, {{lc|std::wcrtomb}}, {{lc|std::wcsrtombs}}, {{lc|std::wctomb}}.  
  
 
===See also===
 
===See also===
{{dcl list begin}}
+
{{dsc begin}}
{{dcl list template | cpp/string/multibyte/dcl list mbsinit}}
+
{{dsc inc | cpp/string/multibyte/dsc mbsinit}}
{{dcl list end}}
+
{{dsc see c | c/string/multibyte/mbstate_t}}
 +
{{dsc end}}
 +
 
 +
{{langlinks|de|es|fr|it|ja|pt|ru|zh}}

Latest revision as of 03:27, 16 June 2020

Defined in header <cuchar>
(since C++17)
Defined in header <cwchar>
struct mbstate_t;

The type mbstate_t is a trivial non-array type that can represent any of the conversion states that can occur in an implementation-defined set of supported multibyte character encoding rules. Zero-initialized value of mbstate_t represents the initial conversion state, although other values of mbstate_t may exist that also represent the initial conversion state.

Possible implementation of mbstate_t is a struct type holding an array representing the incomplete multibyte character, an integer counter indicating the number of bytes in the array that have been processed, and a representation of the current shift state.

The following functions should not be called from multiple threads without synchronization with the std::mbstate_t* argument of a null pointer due to possible data races: std::mbrlen, std::mbrtowc, std::mbsrtowcs, std::mbtowc, std::wcrtomb, std::wcsrtombs, std::wctomb.

[edit] See also

checks if the std::mbstate_t object represents initial shift state
(function) [edit]
C documentation for mbstate_t