C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] Array lvalues in braced initializer lists

From: Joseph Myers <joseph_at_[hidden]>
Date: Tue, 3 Aug 2021 18:05:26 +0000
On Tue, 3 Aug 2021, will wray via Liaison wrote:

> // Variable size array[n] -> array[n] function
> float VLA_function( int n, float (*in)[n] ) [n] // ?
> {
> float out[n];
> for (int i = 0; i != n; ++i ) { out[i] = f((*in)[i]); }
> return out;
> }
>
> ? Is the argument 'n' in scope for the trailing [n] return size ?

Functions can't have variably modified types at present. (And this is the
known case where in practice the scope of the parameter names is
discontiguous - it ends when the prototype ends and restarts in the
function body, when the prototype ends it's not yet known whether there
will be a function definition at all - even if the standard text doesn't
really cover that issue; see the WG14 reflector discussion starting with
message 11668 (21 Feb 2009).)

-- 
Joseph S. Myers
joseph_at_[hidden]

Received on 2021-08-03 13:05:36