🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2161

Re: STL <iostream> vs. <iostream.h>

#2161
From: John Max Skaller
Date: Tue, 10 Oct 1995 17:13
69 lines
1902 bytes
"J\ir\tme Desquilbet" <jDesquilbet@Rational.COM> wrote:
>
>Reading the STL part of the CD, I understand that the sample "Hello world"
>program becomes:

By a using directive:

>#include <iostream>
>int main()
>{
>  using namespace std;
>  cout << "Hello, world!" << endl;
>}
>
>Am I right?

     Thats one way. Here's another with explicit qualification:

#include <iostream>
int main()
{
  std::cout << "Hello, world!" << std::endl;
}

     Here's another with the compatibility header:

#include <iostream.h>
int main()
{
  cout << "Hello, world!" << endl;
}

     Here's another with using declarations:

#include <iostream>
using std::cout;
using std::endl;

int main()
{
  cout << "Hello, world!" << std::endl;
}


>If yes, what about "old" programs written using <iostream.h>? 

    Should continue to work. iostream.h looks basically like:

// file: iostream.h
#include <iostream>
using std::cout;
using std::endl;
using std:istream;
...... (all names are 'used')


-- 
John Max Skaller               voice: 61-2-566-2189
81 Glebe Point Rd              fax:   61-2-660-0850
GLEBE NSW 2037                 email: maxtal@suphys.physics.oz.au
AUSTRALIA                      email: skaller@maxtal.com.au



---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <45cp5c$sd@oznet03.ozemail.com.au>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
References: <45as8l$mf8@rational.rational.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: John Max Skaller <maxtal@suphys.physics.su.oz.au>
Newsgroups: comp.std.c++
Subject: Re: STL <iostream> vs. <iostream.h>
Date: 10 Oct 1995 17:13:54 GMT
Organization: MAXTAL
Approved: matt@physics2.Berkeley.EDU (Matt Austern)
Message-ID: <45cp5c$sd@oznet03.ozemail.com.au>
References: <45as8l$mf8@rational.rational.com>
NNTP-Posting-Host: physics2.berkeley.edu