www.digitalmars.com         C & C++   DMDScript  

c++ - #include <iostream.h> versus #include <iostream>

reply Edward A. Waugh <edward_waugh hotmail.com> writes:
I used C++ 5 years ago and am currently refreshing myself
on the language and I notice in some of the posts use of
#include <iostream> versus the more traditional #include
<iostream.h>.

Why is this the case?

In my installation I have (relative to the base):

./include/iostream.h
./stlport/src/iostream.cpp
./stlport/stlport/iostream
./stlport/stlport/iostream.h
./stlport/stlport/using/iostream
./stlport/stlport/using/h/iostream.h
./stlport/stlport/wrap_std/iostream
./stlport/stlport/wrap_std/h/iostream.h

so I notice no iostream in ./include and 3 versions of
iostream from in the ./stlport directory tree.

Which one should I be using?

Thanks,
Edward
Oct 04 2006
parent reply Gregg <no spam.com> writes:
Edward A. Waugh wrote:
 
 so I notice no iostream in ./include and 3 versions of
 iostream from in the ./stlport directory tree.
 
 Which one should I be using?

<iostream> should be used rather than <iostream.h> This is true in general for all standard library headers. Note that some of the C-legacy headers have a slightly different naming convention: math.h functionality is now accessed via <cmath>. Pick up a copy of Stroustrup and/or Josuttis for reference.
Oct 04 2006
parent reply Edward A. Waugh <edward_waugh hotmail.com> writes:
Thats is fine but #include <iostream> does not work because
the include directory in my installation only has iostream.h
(Why is this case?) Thus my question about which iostream
file to use from the stlport directory tree assuming that
they are versions of iostream that I should be using.

 - Edward
Oct 05 2006
parent reply Gregg <no spam.com> writes:
Edward A. Waugh wrote:
 Thats is fine but #include <iostream> does not work because
 the include directory in my installation only has iostream.h
 (Why is this case?) Thus my question about which iostream
 file to use from the stlport directory tree assuming that
 they are versions of iostream that I should be using.
 
  - Edward

dmc -Ic:\dm\stlport\stlport YourFile.cpp
Oct 05 2006
parent reply Edward A. Waugh <edward_waugh hotmail.com> writes:
Are we cursed or blessed to have to either use

using namespace std;

everywhere or prefix everything with std::?

I don't mind std::cout and std::endl but std::list or
std::map really annoys me.

 - Edward
Oct 24 2006
parent user domain.invalid writes:
Edward A. Waugh wrote:
 Are we cursed or blessed to have to either use
 
 using namespace std;
 
 everywhere or prefix everything with std::?
 
 I don't mind std::cout and std::endl but std::list or
 std::map really annoys me.
 
  - Edward

On my experience this is very useful. It is possible for more than one header file to implement e.g. list and it is important to be able to control what is being used where. Best wishes John Fletcher
Oct 27 2006