Thread overview
#include <iostream.h> versus #include <iostream>
Oct 04, 2006
Edward A. Waugh
Oct 04, 2006
Gregg
Oct 05, 2006
Edward A. Waugh
Oct 05, 2006
Gregg
Oct 24, 2006
Edward A. Waugh
Oct 27, 2006
user
October 04, 2006
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
October 04, 2006
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.

October 05, 2006
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
October 05, 2006
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
Use the one in ./stlport/stlport/iostream per your original post.

dmc -Ic:\dm\stlport\stlport YourFile.cpp


October 24, 2006
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
October 27, 2006

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