0

Possible Duplicate:
Difference between iostream and iostream.h

My professor said that the following:

#include <iostream.h>  

is the same as:

#include <iostream>
using namespace std;  

I'm a bit confused. What is the difference between iostream and iostream.h?

Community
  • 1
  • 1
eveo
  • 2,797
  • 15
  • 61
  • 95

2 Answers2

8

iostream.h is not part of the standard C++ library whereas iostream is. Names in iostream.h are not in the std namespace, whereas those in iostream are. By issuing the directive using namespace std after including iostream, all names defined there (and in any other standard library includes) are brought into the global namespace. That is usually not a good thing, but it does provide some level of equivalence between the standard and non- or pre-standard versions.

As far as claiming that they are "the same" as each other, this is unlikely. iostream adheres to the standard, and will have evolved w.r.t. iostream.h. This is particularly true if you consider the C++11 standard.

David G
  • 94,763
  • 41
  • 167
  • 253
juanchopanza
  • 223,364
  • 34
  • 402
  • 480
1

Some very old compilers have used iostream.h, but it's not part of the standard. Only the extensionless header files are. It won't even be recognized by modern standard-compliant compilers.

lethal-guitar
  • 4,438
  • 1
  • 20
  • 40