www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

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

↑ ↓ ← 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
↑ ↓ 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
↑ ↓ 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
↑ ↓ 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
↑ ↓ 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
↑ ↓ → 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