3 ms·
Add this to the fact that the vast majority of libc functions are either obsolete or simply designed for another era, and it can become a quite daunting feat tr
by qalmakka 6y ago
Add this to the fact that the vast majority of libc functions are either obsolete or simply designed for another era, and it can become a quite daunting feat trying to write C code without shooting yourself in the face. C++ isn't in a great position either (the whole std::locale fiasco is very similar), but at least the standards since C++11 have had the guts to actually attempt fixing the warts instead of simply ignoring problems altogether.
All C standards since C99 have been ugly mishmashes of C++ features and bad ideas, one after another. What everyone was clearly asking them was to just copy-paste stuff from POSIX, and instead they came up with stupid nonsense like VLA or things nobody uses, like the [static N] syntax for arrays.
I also still find absurd someone thought it was a good idea to add stuff as critical as threads.h without asking implementers first if they liked it (fun fact no one did).
What I think is a massive indicator of how much disconnected they are from reality is the "memory safe string handling" they added in C11 with those crappy *_s functions, which a. were just annoyingly slightly different from what POSIX and Win32 had and b. used a totally lunatic error reporting system based on callbacks and `set_constraint_handler_s()` - because obviously when a call to memset_s() fails I totally want a random function to run, for what for I still don't understand after 9 years.
People just wanted the BSD's _l functions, and they gave them a memcpy() that called a random callback. No wonder C2X just wants to quietly pretend these abominations nobody ever implemented never happened.
What no one has ever had enough guts to admit is that 1. C strings, i.e. null-terminated strings, were a terrible mistake and 2. that C badly needs a new string library, or at least something that people can use without risking leaking their whole address space by accident.
- nullc 6y ago> write C code without shooting yourself in the face Use absolutely no strings. :) But right. :)
- craftinator 6y agoInstead of strings, you could just use binary bitmaps and directly manipulate those into text!
- nullc 6y agoNo worse than UTF16... :P