For example printf
instead of cout
, scanf
instead of cin
, using #define
macros, etc?
There are better solutions for most cases, but not all.
For example, people quite often use memcpy
. I would almost never do that (except in really low-level code). I always use std::copy
, even on pointers.
The same counts for the input/output routines. But it’s true that sometimes, C-style printf
is substantially easier to use than cout
(especially in logging). If Boost.Format isn’t an option then sure, use C.
#define
is a different beast entirely. It’s not really a C-only feature, and there are many legitimate uses for it in C++. (But many more that aren’t.)
Of course you’d never use it to define constants (that’s what const
is for), nor to declare inline functions (use inline
and templates!).
On the other hand, it is often useful to generate debugging assertions and generally as a code generation tool. For example, I’m unit-testing class templates and without extensive use of macros, this would be a real pain in the *ss. Using macros here isn’t nice but it saves literally thousands of lines of code.