printf VS cout

Ian Lance Taylor iant@google.com
Sat Jun 9 16:21:00 GMT 2007


Detlev Casanova <detlev.casanova@gmail.com> writes:

> They say that with C++, the printf() function must not be used at all, that 
> cout is to be used. they say that printf() is only for C programming.
> 
> On a personnal project, I use printf() a lot even if it is in C++.
> 
> So, is it true ? Do I have to use cout instead of printf in C++ code ?

This question is more appropriate for gcc-help than for libstdc++,
which is a developer's list.  Please take any followups to gcc-help.
Thanks.

printf works fine in C++ code.  Whether to use it or not is entirely a
matter of programming style.

Ian



More information about the Libstdc++ mailing list