Re:Best aspects of C
by arcticbull on Tuesday November 17, 2020 @04:09PM
(#25129868)
C++ is IMO defined by a complete lack of opinion. They just standardized every opinion. For everything. C++ would be a much better language if it showed some opinion, even if I disagreed with it.
That's honestly how I also feel about C++ in when I look at how often they are adding new things.
Re:Best aspects of C
by WalterBright on Tuesday November 17, 2020 @10:44PM
(#25132964)
In my long C career, I invented string library after string library. They all turned out to be garbage. The common cause of their failures is their inability to interact with any other C code.
Agreed, but that's an issue for all "interface types" on API boundaries (another similar issue is vector and matrix types in math libraries). IMHO a C string library must still be able to efficiently consume and produce vanilla zero-terminated "const char*" string data (and at a stable address, unlike for instance std::string) even if they mostly work with {pointer,length} ranges internally.
Re:Best aspects of C
by WalterBright on Wednesday November 18, 2020 @07:06AM
(#25135868)
C strings are so ubiquitous that the ABI impedance mismatch is just too annoying.
> Same for string handling/processing, there are specialized libraries out there which do a specific job better
I actually can't think of a lot of these that are super common across projects.
ICU is probably the most notable one, with its particular focus on unicode correctness.
A lot of large projects end up writing their own string library of sorts.
Same for string handling/processing, there are specialized libraries out there which do a specific job better than the rather generic standard library functions (this is also true for the C++ stdlib), one just has to find those libraries.
PS: I don't think that a "batteries included" standard library (like python has) would even make sense for C, such a library would need to be opinionated by definition, better to keep (too many) opinions out of the standard, as this road just leads to another C++ ;)