3 ms·
A lot of code is still written in C89 for maximum portability, and I regularly do that. The only thing I really miss from C99 is the mixed declarations and code
by userbinator 9y ago
A lot of code is still written in C89 for maximum portability, and I regularly do that. The only thing I really miss from C99 is the mixed declarations and code, but you can instead use nested scopes or just move the declarations up to the top.
- bangonkeyboard 9y agoC99 object literals are also fantastic. I feel very constrained when I have to use strict C89. Meanwhile, in terms of C11 [update: actually also from C99] I actually wrote a function with a signature like void func(int arg[static 3]); but later removed it because (a) the generated code was the same, and (b) rather than increasing clarity and self-documentation, it caused confusion; even when you're familiar with the feature, it never stops looking like a syntax error.
- loeg 9y agoI do love object literals. The 'static' keyword for array parameters actually dates to the C99 standard.
- bangonkeyboard 9y agoYou're 100% correct, my mistake.
- pcwalton 9y agoWhat portability do you need, specifically, beyond C99?
- userbinator 9y agoA lot of compilers for embedded systems are still C89 (with a few architecture-specific extensions).
- pcwalton 9y agoWhich systems, specifically?
- sclangdon 9y agoUntil recently, even MSVC was C89. I believe they only added some C99 features because the C++11 standard required them (in VS2013, I believe), and full C99 support only came with VS2015.
- pjmlp 9y agoYep, their focus is on C++ compatibility. They have changed their view regarding C, but the actual work is customer driven. https://www.reddit.com/r/cpp/comments/75q5wc/visual_studio_2017_version_154_released/ https://www.reddit.com/r/cpp/comments/75q5wc/visual_studio_2...
- simias 9y agoAnd stdint.h, variadic macros, restrict, inline (admittedly less necessary as compilers become more clever), flexible array members... I mainly still stick to variable declaration at the beginning of the block out of habit but it would be a pain for me to go back to C89 and forsake all these other nice features.