Skip to content

[dcl.init.string] p1 Successive characters initializing array elements make nosense after P2314 #5103

Open
@xmh0511

Description

@xmh0511
Contributor

Successive characters of the value of the string-literal initialize the elements of the array.

Since P2314 introduces a clear concept about "code unit", which is an integer value of a character type that is the type of the element of the character arrays. So, this outdated wording should be improved

Successive code unit values of the string-literal initialize the elements of the array.

Activity

self-assigned this
on Nov 20, 2021
jensmaurer

jensmaurer commented on Nov 20, 2021

@jensmaurer
Member

The problem is that [lex.string] only creates a sequence of code unit values if we initialize a string literal object, but that doesn't appear in [dcl.init.string].

See the pull request.

xmh0511

xmh0511 commented on Nov 21, 2021

@xmh0511
ContributorAuthor

@jensmaurer I think the following modification may be clearer.

Each element of the array is copy-initialized from the corresponding code unit value in the sequence of code unit values represented by the string-literal.

This can stress that every element of the array is a container that saves the code unit value. [lex.charset] p5 implies this point but it is not exposed in the initialization of the character array.

A code unit is an integer value of character type ([basic.fundamental]).

The character type is exactly the type of the element of the array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @xmh0511@jensmaurer

    Issue actions

      [dcl.init.string] p1 Successive characters initializing array elements make nosense after P2314 · Issue #5103 · cplusplus/draft