If I have to guess, it's probably to support operator overloading (printing custom data type) without requiring OOP e.g. must be a class that implements Writable
Why do you feel it's a good idea to shove networking into the standard library? Doesn't your choice of network library depend on other tech decisions regarding things like sync/async IO?
And moreover, if you want a java-like standard library that's good enough then you already have a bunch of options like Qt, Boost, POCO, etc.
Because every other PL has networking now. Because the lack of a networking framework fragments the C++ library ecosystem and prevents the development of re-useable and interoperable higher level libraries. The lack of such interoperable libraries make C++ a third-class citizen in the choice of language for middleware development.
Someone needs to write a book "C++ The Good Parts", similar to Douglas Crockford's "Javascript the good parts".
C++ is insanely bloated and complex. If there is a book distilling the best and cleanest parts of the language, I might give it another look. Haven't considered it in earnest since College.
It seems rude to call something a code smell the instant (or… two years before the instant?) it gets replaced. Though it is C++, where you're apparently never supposed to use several of the features.
Well that's fine, but it would be nice to have more official guidance, like editions/profiles/versions that turn things off as well as on. There are some standards, but mostly you just get self-proclaimed C++ experts telling you you suck if you write a `new` statement and don't use whatever kind of smart pointer is the right one now.
25 comments
[ 2.1 ms ] story [ 58.8 ms ] threadHowever, in C++98, how else would you handle when you have an arbitrary number of things to print in a type-safe way? e.g.
printf is not type-safe, nor supports user defined types. I'd rather not write 8 lines of functions calls for the same thing either.I think it made some sense C++98, though it is an awful API in 2021.
Possible with preprocessor.
If I were the one designing the language, I'd have simply fixed printf to be type-safe. (e.g. via adding macro support a la Lisp)
Qt does it right: fluent-style interface which does string interpolation.
And moreover, if you want a java-like standard library that's good enough then you already have a bunch of options like Qt, Boost, POCO, etc.
Networking is an extremely standard need, making the standard library a good place for it.
C++ is insanely bloated and complex. If there is a book distilling the best and cleanest parts of the language, I might give it another look. Haven't considered it in earnest since College.
Although, I mean, iostreams is pretty bad.