Skip to content

C99 variable-length arrays in C++ #479

@ilionsd

Description

@ilionsd

Channel
C++Weekly

Topics
Why variable-length arrays are available in C++ as a compiler extension (why not part of standard and why not removed altogether).
The good (they were added to C99 for some reason, right? Right?)
The bad (sizeof becomes runtime)
The ugly (
Lets say we have:
template<typename T> struct S {};
How are we (and compiler supposer to interpret:

int arr[n];
S<decltype(arr)> s;

Well, the compiler disallows it. So we get "part of the language" that doesn't work with other part of the language
)

Length
Probably 5-10 minutes

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions