Re:C++23: The Next C++ Standard
by Sniffnoy on Tuesday July 11, 2023 @05:24PM
(#36687419)
I mean, the function for straight printing is puts; I don't know why people keep using the much more complicated printf in cases where no formatting is involved.
Edit: OK, I guess puts includes a newline, so you'd need to use fputs if you don't want that (although this example includes one). Still, both of those are much less complicated than printf!
Re:C++23: The Next C++ Standard
by izoow on Tuesday July 11, 2023 @05:31PM
(#36687492)
Consistency. Having intermixed puts and printfs throughout the code looks pretty bad. Also, every compiler replaces printf of a literal ending with \n with a puts anyway.
Edit: OK, I guess puts includes a newline, so you'd need to use fputs if you don't want that (although this example includes one). Still, both of those are much less complicated than printf!