News for hackers. Stuff that matters.
Re:Learn Modern C++ by einpoklum on Tuesday December 26, 2023 @12:21PM (#38773700)
There are numerous shortcoming of the previous (iostreams) approach:

1. Incompatible with dynamically-generated format strings, in which the order of arguments is different. Example:

   std::cout << month << '/' << day << '/' << year
... but you now want to adapt that for a non-US locale, e.g. a European one where it's

   std::cout << day << '/' << month << '/' << year
with iostreams, you have to change the code. With C-style printf, you don't (but it's not typeafe and not flexible. But with std::print it could be:

   std::printf(my_format_str, day, month, year);
and `my_format_str` could be either "{0}/{1}/{2}" or "{1}/{0}/{2}".

2. The string allocations which other have mentioned.

3. A lot more typing that is easy to confuse: " << ".

4. The iostreams implementation is super-baroque, with buffer classes nobody uses.

and maybe I'm forgetting things.

Re:Learn Modern C++ by AtlasBarfed on Tuesday December 26, 2023 @06:30PM (#38777224)
Std:so std:you std:mix std:iosteam std:and std:printf?

Std:seems std:confusing