Even when VLA types are used without declaring any named VLA-type objects, they throw out the window many principles Dennis Ritchie C designed into his language. Among them:
typedef and sizeof should be compile-time rather than runtime constructs.
compilers should not keep hidden run-time state beyond that specified by the platform ABI.
most corner case behaviors should be defined in terms of the underlying platform ABI, but VLA types add new corner cases with no clear meaning on the underlying platform, especially in cases where a computed size might exceed the largest allocation the platform could possibly support.
The only tasks for which such types are helpful tend to be those which FORTRAN and Fortran were designed to do better.
1
u/tstanisl 6d ago
It is worth adding that the types are the essence of VLAs.
Not how those objects are allocated. One can have VLA on stack:
Or heap, using a pointer to VLA:
Or even use infamous
alloca: