3 ms·
What, is auto and constexpr coming to C?! https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3220.pdf#subsection.8.2.2 https://www.open-std.org/JTC1/SC22/WG14/ww
by Alifatisk 2y ago
What, is auto and constexpr coming to C?! https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3220.pdf#subsection.8.2.2 https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3220.pdf#s...
- feverzsj 2y agoAt this rate, they may just switch to C++ mode.
- pjmlp 2y agoIt won't work, modern C is all about being C++ without classes and templates, while coming up with worse approaches (_Generic), apparently. Now better ways of doing strings and arrays, no need for something as modern as 1976's PL/I way of doing them.
- mmaniac 2y agoWhat's so bad about _Generic? I would not let the name distract you - it's equivalent to overloading, not "generics" (i.e. parametric polymorphism) In that capacity I think it's quite a lot more sane than C++. Having a closed set of overloads, not having name mangling, not having complex name lookup rules are all a good thing.
- johnisgood 2y agoI have made a lengthy comment about why I dislike C23. I cannot find it right now, but yeah, mainly because it is kind of turning into C++ and I do not like that, that is why I will continue sticking to C99. The earlier version of the book is great for that.
- chongli 2y agoI have to say, of all programming languages, C is the one which gets the most strident opposition to the most minor of changes. I would love to read your reasoning because so far I have not been able to understand the stiff resistance to what I see are very positive changes aimed at cleaning up so much of the mess that is C.
- johnisgood 2y agoI found one of the threads, there were others, too, IIRC. https://news.ycombinator.com/item?id=41854897 https://news.ycombinator.com/item?id=41854897
- pjmlp 2y agoIt is so well designed, that is getting fixed in C2y, "...is a deeply hated C feature that everyone likes to dunk on for both being too much and also not being good enough at the same time" https://thephd.dev/improving-_generic-in-c2y https://thephd.dev/improving-_generic-in-c2y
- z_open 2y agoauto is insane seeing as how it's already a reserved keyword in C.
- jcelerier 2y agoIt used to be in c++ too and I have never even heard of a conflict this caused
- eska 2y agoauto is a historic artifact for porting code from the B language to C, when everything was implicitly int but int did not exist yet. It had absolutely no use afterwards, which is why it was repurposed in C++ as well. In C23 this is done because it is very useful in combination with typeof() in macros, which is a far cry from SFINAE terrorism in C++
- ndiddy 2y agoI have never seen anyone use auto in code newer than the mid-70s, apart from C++ programmers accidentally using it in a case where it happens to work.
- pjmlp 2y agoIn the 1980's it was still around in compilers that were K&R C subsets for 16 bit home computers.