www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/18/22:01:55

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problem compiling c++
Date: 18 Aug 2001 21:22:47 -0400
Organization: MindSpring Enterprises
Lines: 31
Sender: nate AT mercury DOT bitbucket
Message-ID: <83u1z4q1w8.fsf@mercury.bitbucket>
References: <3B7CEDE9 DOT 17D0DCC9 AT hotmsil DOT com> <ihrqntgo5rd50bnmq8lr76pt7bsn1r6sk3 AT 4ax DOT com> <3B7F0AB9 DOT 5080903 AT operamail DOT com>
NNTP-Posting-Host: a5.f7.70.d7
Mime-Version: 1.0
X-Server-Date: 19 Aug 2001 01:22:48 GMT
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Sahab Yazdani <sahaby AT operamail DOT com> writes:

> [snip]
> > 
> > #include <iostream>
> 
> > using namespace std;
> ^^^^^^^^^^^^^^^^^^^^^^
> what does this do?? I have a bunch of books on C++, but i've never run 
> across this line b4.

You have old books.  AFAIK, all the standard C++ library functions are
now defined to be in the `std' namespace.  (Namespaces are another
more recent C++ feature that allow several things with the same name
to coexist, regardless of their scope.)  You'd normally have to write

std::cout << "hello";

The `using namespace foo' directive tells the compiler to assume that
anything whose namespace is not explicitly given is in namespace
`foo'.

Recent editions of Stroustrup cover this.

The people in comp.lang.c++ can probably give you a more exact
description of this feature.

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019