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.
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.
Sadly no. It is a shame.
Try NetBSD 🙂
Would this work for people working on micro-controllers?
Compilers for micro-controllers might not support even the C89 standard. However, a $5 Raspberry Pi would support C99.
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.
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.