Get the latest tech news

C99 doesn't need function bodies: VLAs are Turing complete


19 Feb 2022 The 1999 revision to the C programming language brought several interesting changes and additions to the standard. Among those are variable length arrays, or VLAs for short, which allow array types to have lengths that are determined at runtime.

I couldn't find anywhere in the standard saying whether this evaluation order is well-defined but it is what clang and gcc do, and luckily, it does not matter for the sake of this article, as we will see shortly. Remember that the VLA length expression can access previous function arguments, so parameter passing is essentially unchanged. Although not relevant to standard C99, in case you had the idea of using gcc statement expressions to bypass these limitations, the compiler will stop you right on your tracks since it doesn't allow those outside of function bodies.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of C99

C99

Photo of VLAs

VLAs

Photo of function bodies

function bodies

Related news:

News photo

RGFW: Single-header C99 window abstraction library

News photo

Algebraic Data Types for C99