20 Library introduction [library]

20.4 Method of description (Informative) [description]

20.4.2 Other conventions [conventions]

20.4.2.1 Type descriptions [type.descriptions]

20.4.2.1.5 Character sequences [character.seq]

The C standard library makes widespread use of characters and character sequences that follow a few uniform conventions:

declared in <clocale>.

20.4.2.1.5.1 Byte strings [byte.strings]

A null-terminated byte string, or ntbs, is a character sequence whose highest-addressed element with defined content has the value zero (the terminating null character); no other element in the sequence has the value zero.163

The length of an ntbs is the number of elements that precede the terminating null character. An empty ntbs has a length of zero.

The value of an ntbs is the sequence of values of the elements up to and including the terminating null character.

A static ntbs is an ntbs with static storage duration.164

Many of the objects manipulated by function signatures declared in <cstring> are character sequences or ntbss. The size of some of these character sequences is limited by a length value, maintained separately from the character sequence.

A string literal, such as "abc", is a static ntbs.

20.4.2.1.5.2 Multibyte strings [multibyte.strings]

A null-terminated multibyte string, or ntmbs, is an ntbs that constitutes a sequence of valid multibyte characters, beginning and ending in the initial shift state.165

A static ntmbs is an ntmbs with static storage duration.

An ntbs that contains characters only from the basic execution character set is also an ntmbs. Each multibyte character then consists of a single byte.