Date: Mon, 15 Jun 2020 10:44:22 +0300
On Mon, 15 Jun 2020 at 10:24, Bernhard Manfred Gruber via
Std-Discussion <std-discussion_at_[hidden]> wrote:
>
> Hi Hollowone PL,
>
> what you discovered is actually a feature. It's called VLAs (Variable Length Arrays).
>
> Strictly speaking, VLAs are not a C++ feature but were introduced in the C99 standard and then made optional in C11.
> Your compiler is supporting them, because it supports C as well to C++.
It does come as a surprise to innocent users that g++ is not a C++
compiler out of the box. Run it with -std=c++20 -pedantic-errors
and it becomes one. It will default to a -std=gnu++, not a -std=c++,
and even with the latter, it still doesn't bother warning about or
rejecting extensions, so you need to ask it to do so.
Std-Discussion <std-discussion_at_[hidden]> wrote:
>
> Hi Hollowone PL,
>
> what you discovered is actually a feature. It's called VLAs (Variable Length Arrays).
>
> Strictly speaking, VLAs are not a C++ feature but were introduced in the C99 standard and then made optional in C11.
> Your compiler is supporting them, because it supports C as well to C++.
It does come as a surprise to innocent users that g++ is not a C++
compiler out of the box. Run it with -std=c++20 -pedantic-errors
and it becomes one. It will default to a -std=gnu++, not a -std=c++,
and even with the latter, it still doesn't bother warning about or
rejecting extensions, so you need to ask it to do so.
Received on 2020-06-15 02:47:43