www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/24/15:59:39

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Internal compiler error - not covered by the FAQ
Date: Tue, 24 Oct 2000 19:05:38 GMT
Organization: always disorganized
Lines: 34
Message-ID: <39f5dd04.35951623@news.freeserve.net>
References: <8t3lg2$o6t$1 AT nnrp1 DOT deja DOT com>
NNTP-Posting-Host: modem-88.north-dakota.dialup.pol.co.uk
X-Trace: news7.svr.pol.co.uk 972414339 11124 62.137.85.88 (24 Oct 2000 19:05:39 GMT)
NNTP-Posting-Date: 24 Oct 2000 19:05:39 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Rudolf Polzer wrote:

> And, as I discovered, DJGPP puts all standard library names into the
> global namespace,

It's GCC that does that.  However, it also puts them in namespace std,
(or, at least, acts as if it does) so there's little problem in practice.

> and recompiling in standard-compliant compilers fails.

Only if you were taking advantage of the fact that GCC dumps everything
into the global namespace.  (I've seen a number of posts where people
have done that - there's an awful lot of broken C++ code out there...)

> Is there a trick to always include the namespace std (or even
> better: to allow a std:: before an identifier causing no harm in DJGPP)?
> What happens if I do this:
> 
> using namespace std;
> #include <iostream>
> 
> int main()
> {
>  cout << "Hello World!" << endl;
> }
> 
> in standard-compliant compilers? Do I need to define the namespace
> before? Must the using directive be after the includes?

What you have above doesn't work in Borland C++ 5.5.  But, of course,
it will work if you put the using directive after the #include.
The best thing to do is to go through and fix your code by hand, even
if that just means putting a using directive (in the correct place)
in each file.

- Raw text -


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