News for hackers. Stuff that matters.
Re:Everything I wish I knew when learning C by LegionMammal978 on Monday November 28, 2022 @11:08PM (#33783583)
VLAs can be declared in a single statement, but they cannot be initialized in C17 (6.7.9):

> The type of the entity to be initialized shall be an array of unknown size or a complete object type that is not a variable length array type.

Curiously, C23 actually seems to break the O(1) rule, by allowing VLAs to be initialized with an empty initializer:

  int arr[n] = {};
GCC generates a memset call (https://godbolt.org/z/5v31bKs5a) to fill the array with zeros.

There are no comments on this comment yet.