Join Nostr
2026-05-29 12:02:27 UTC

Paul on Nostr: TIL: Constant folding in C is a GCC extension (though it works in LLVM / clang), ...

TIL: Constant folding in C is a GCC extension (though it works in LLVM / clang), therefore you can't do something like this:

const int STATUS_SUCCESS = 1;

switch (status) {
case STATUS_SUCCESS:

The joys of the difference between const, a constant expression, and what can be determined at compile-time (it's clearly possible to fold the constant at compile-time, but presumably not portable).

#C