c++ - Is initializing a VLA with braces a GCC bug or extension? -



c++ - Is initializing a VLA with braces a GCC bug or extension? -

with next code in mind:

int main() { int n = 3; int arr[n] = { 1, 2, 3 }; }

gcc errors out in c99 mode error: variable-sized object may not initialized , clang gives same error in c++ mode. in c++ mode, gcc doesn't complain. lead me believe it's perchance extension that's not documented on c extensions vla page. couldn't find matching bug study either. can verify if extension or if there's existing bug report?

this new behaviour is mentioned in suspect may correlated gcc 4.9 release notes:

g++ supports c++1y variable length arrays. g++ has supported gnu/c99-style vlas long time, now additionally supports initializers , lambda capture reference. in c++1y mode g++ complain vla uses not permitted draft standard, such forming pointer vla type or applying sizeof vla variable. note appears vlas not part of c++14, part of separate document , perhaps c++17.

note default standard mode c++ still gnu++98/gnu++03 release.

c++ c gcc variable-length-array

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -