Many C++ programmers
instead of the newer, standard compliant
library. What are the differences between the two?
.h notation of standard header files was deprecated more than five years ago. Using deprecated features in new code is never a good idea.
In terms of functionality,
<iostream> contains a set of templatized I/O classes which support both narrow and wide characters, as opposed to
<iostream.h> which only supports
- The C++ standard specification for iostream’s interface was changed, with many subtle aspects. Consequently, the interfaces and implementation of
<iostream> differ from those of
<iostream> components are declared in namespace
<iostream.h> components are in global scope (chances of name conflicts are greater).
For these reasons, you should never mix the two libraries in one program. As a rule of thumb, use the newer
header file, unless you are dealing with legacy code that is only compatible with
. Otherwise, my suggestion is always to upgrade from the older version to newer version, which is quite easy to do.