Daniel Lemire's blog

, 4 min read

The new C standards are worth it

7 thoughts on “The new C standards are worth it”

  1. Good advances every one. I don’t suspect they will be coming to the Linux Kernel any time soon – which is one of the only places where I use plain C.

    1. Sadly no. It is a shame.

    2. Alex says:

      Try NetBSD 🙂

  2. Imran says:

    Would this work for people working on micro-controllers?

    1. Compilers for micro-controllers might not support even the C89 standard. However, a $5 Raspberry Pi would support C99.

  3. Ben says:

    Mixing variables with code has always been a terrible idea / practice. Put them up front, together, so they can be found easily, so the compiler can allocate and release them in one stack frame, so you have an easier time seeing WTF you’re doing in terms of memory load, so your IDE can tell you, all in one place, what you need to clean up. Never declare a function’s variables away from the head of the function. You’re just making things harder on everyone, including yourself, and you might be causing lousy code generation as well. The lazy-making “benefit” of scattering variables all over a function is wholly illusory. 40 years of coding experience speaking here.

    1. so the compiler can allocate and release them in one stack frame (…) and you might be causing lousy code generation as well

      Any performance benefit you might perceive after declaring variables up front is, to use your own term, “wholly illusory”.

      We can certainly debate maintainability and readability, but not performance.