C23 ISO Standard Is Here But You Probably Won't Read It |
Written by Mike James | |||
Wednesday, 06 November 2024 | |||
At last ISO C23 has been published, but at $250 you probably aren't going to read it. Can we really tolerate this sort of profiteering on the work of others? This is worse than academic publishing! In case you are wondering, the $250 price tag is for a PDF so it can't even be argued that this is to pay for production costs. You can, however, argue that as the standards committee makes draft standards freely available, you don't need to buy the final publication. But can you really base your work on something that isn't the final? Other languages don't seems to suffer this problem - JavaScript - sorry ECMAScript 2024 - is free to download; Java is free to download, from Oracle of all people; C# is also free and Python doesn't really have a specification, only a reference implementation in the form of CPython. In fact, the only popular languages you have to pay for are C and C++. This is unacceptable. Of course, you could take the attitude that the only people who have to buy the standards are the compiler writers, but who says they get it right all the time. In practice, however, I have to agree that most of us simply seek to satisfy the compiler - if it compiles and does what you intend then who needs to check the standard? Well you might if you plan to compile your program on other platforms/ but again, in my experience, it is generally a matter of how the compiler writer interprets the less-than-perfect specifications in the standard. Then there is the issue of undefined behavior. Am I really expected to pay $250 for a document that cannot be bothered to define what happens when a signed value rolls over? Seems to me a standard should be complete, not undefined. Of course, I am joking, but only slightly - the whole issue of undefined behavior is crazy and needs to be dealt with no matter what the cost of the standard. In real life all behavior is defined by the machine - all you have to do is recognize what this is and go with the majority. On the subject of C23 support - after all compilers reify the standard and it is the real world we program in - the good news is that since GCC 14, C23 support has been almost complete. Now with version 15, GCC is set to make C23 the default version unless you state otherwise. The other main C compiler, Clang, is not far behind as is Apple's version of C lang, but of course Microsoft's C compiler is miles behind and hardly worth considering as a C compiler - its a C++ compiler first. So what is new in C23? That question has largely been answered by our early look at the standard, see C23 - What We Have To Suffer by Harry Fairhead. I have to say that I agree 100% with his position. I don't use C for IoT programming, but when I do use it I don't want it turned into C++ or Java - if I wanted that I'd use a different language. Keep C as a machine independent assembler and make additions that fit in with that notion. The new features that do fit in with this idea are:
and so on. However, there are some additions that are just unwanted. Harry lists unreachable as one particular waste of space. I'd like to add the extension of auto to mean "infer the type". For example: auto n=1; will be compiled as if you had written: int n=1; It is claimed that this will make macros easier to write correctly. C isn't a typed language in the same sense that other languages are typed. C mainly deals in data types that are primitive types which differ in the number of bits and how they are processed by operators. If writing auto x = 255; takes over from char x = 255; then we are going to be much worse off. A big part of C programming, as distinct from using other languages, is knowing how many bits you have and, with the generally weak understanding of the type of constants, this is going to be a problem.
More InformationISO/IEC 9899 - Revision of the C standard Related ArticlesC Is Number One Language Again C Undefined Behavior - Depressing and Terrifying (Updated) GCC Gets An Award From ACM And A Blast From Linus To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info <ASIN:1871962889> |
|||
Last Updated ( Wednesday, 06 November 2024 ) |