C++ Logo

std-proposals

Advanced search

Re: Arrays (VLAs) as function parameters (as in C99)

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Sun, 7 Nov 2021 10:15:43 +0100
On 06/11/2021 22.31, Alejandro Colomar (man-pages) via Std-Proposals wrote:
> However, VLA syntax for function parameters does not suffer from those
> issues: it is just syntactic sugar for pointer parameters.

I'm not sure about that. My understanding is that sizeof(param) will
yield a runtime value in the body of the called function if "param" is
a VLA.

> My proposal is to add VLA syntax to C++, to add compatibility with C
> headers, and also to have the same self-documentation that C prototypes
> already have.

Please make sure to include a discussion about the sizeof behavior
should you choose to write a paper proposing VLA parameters for
C++.

Jens

Received on 2021-11-07 03:15:49