News for hackers. Stuff that matters.
Re:What is your favorite C programming trick? (2009) by saagarjha on Monday November 23, 2020 @03:48AM (#25184795)
The one good use of VLAs I know of is casting a buffer into a multidimensional (variable-length) array to allow for subscripting to work.
Re:What is your favorite C programming trick? (2009) by pjmlp on Monday November 23, 2020 @04:00AM (#25184858)
Whatever good uses VLAs might actually have had, they are gone with C11.
Re:What is your favorite C programming trick? (2009) by saagarjha on Monday November 23, 2020 @04:05AM (#25184896)
Well, they're a conditional feature now, you are supposed to check __STDC_NO_VLA__.
Re:What is your favorite C programming trick? (2009) by pjmlp on Monday November 23, 2020 @10:26AM (#25187683)
Which basically means that outside gcc and clang based compilers, __STDC_NO_VLA__ will be false, for example on MSVC or IAR Embedded Workbench.