C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Small C compatibility extensions for array

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Sun, 23 Oct 2022 13:58:01 +0100
On Sun, 23 Oct 2022, 13:56 Sebastian Wittmeier via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

> What do you specifically propose? VLAs?
>
I think they're proposing adoption of the [static] array parameter syntax.
Difficult to be sure, though.

> -----Ursprüngliche Nachricht-----
> *Von:* blacktea hamburger via Std-Proposals <
> std-proposals_at_[hidden]>
> *Gesendet:* So 23.10.2022 14:24
> *Betreff:* [std-proposals] Small C compatibility extensions for array
> *An:* std-proposals_at_[hidden];
> *CC:* blacktea hamburger <greenteahamburger_at_[hidden]>;
> cppreference <https://en.cppreference.com/w/c/language/array>:
>
> *[* *static*(optional) qualifiers(optional) expression(optional) *]*
> attr-spec-seq(optional) (1)
>
> *[* qualifiers(optional) *static*(optional) expression(optional) *]*
> attr-spec-seq(optional) (2)
> expression - any expression other than comma operator
> <https://en.cppreference.com/w/c/language/operator_other#Comma_operator>,
> designates the number of elements in the array
> qualifiers - any combination of const
> <https://en.cppreference.com/w/c/language/const>, restrict
> <https://en.cppreference.com/w/c/language/restrict>, or volatile
> <https://en.cppreference.com/w/c/language/volatile> qualifiers, only
> allowed in function parameter lists; this qualifies the pointer type to
> which this array parameter is transformed
>
> In function parameter lists, additional syntax elements are allowed within
> the array declarators: the keyword *static* and qualifiers, which may
> appear in any order before the size expression (they may also appear even
> when the size expression is omitted).
>
> In each function call
> <https://en.cppreference.com/w/c/language/operator_other#Function_call> to
> a function where an array parameter uses the keyword *static* between *[*
> and *]*, the value of the actual parameter must be a valid pointer to
> the first element of an array with at least as many elements as specified
> by expression:
>
> If qualifiers are present, they qualify the pointer type to which the
> array parameter type is transformed
> They are also useful for C++ and improve C compatibility.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2022-10-23 12:58:16