cpp_weekly
cpp_weekly copied to clipboard
C99 variable-length arrays in C++
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