Liste des Groupes | Revenir à cl c++ |
On 01/01/2025 17:33, Muttley@dastardlyhq.com wrote:Now maybe, but when the language was new I don't see the problem in creating newOn Wed, 1 Jan 2025 18:25:27 +0200>
Michael S <already5chosen@yahoo.com> gabbled:Introduction of format() already showed that C++ committee is aware ofPlus overloading << and >> was a cretinous decision. There was zero reason
of the fact that "Stroustrup streams" are crap not only relatively to
format/printing facilities of more modern languages, but relatively
to what we have in C as well. std::print() proves that committee is not
only aware of the fact, but finally willing to consider fixes.
he couldn't have created some new operators to avoid confusion, <<< and >>>
or <= , => for example where such combinations in C would never be legal
syntax anyway.
I don't actually agree - I think the choice of << and >> was not a bad one, though <= and => could have worked too. Adding new operators just for the purpose of streams would have been overkill, IMHO. The big
alternative would have been to have a way to add new operators to the language. That would have been a huge change to C++ - the language, theWhy would it?
IMHO the real mistake for iostreams for formatted output was making them modal - IO manipulators are a /terrible/ idea. The type system and overloading should have been used instead, so that we would write :Agreed.
>
cout << hex(x);
>
instead of
>
cout << hex << x << dec;
There are still plenty of other issues with the iostreams formatted output, but the choice of operator is the least of the problems.Personally I think printf() should have been upgraded for C++ from the start
Les messages affichés proviennent d'usenet.