Newsgroups: comp.lang.c++.moderated
From: "Esa" <x...@y.z>
Date: 12 Jun 2001 10:01:18 -0400
Local: Tues, Jun 12 2001 10:01 am
Subject: How to say: NOT using namespace std
I have defined in my code in the global scope:
using namespace std; How do I turn it off, i.e. that I am not using namespace std anymore? /Esa [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ] You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.c++.moderated
From: Fehér...@ronto.lmf.ericsson.se,
Date: 12 Jun 2001 12:56:43 -0400
Local: Tues, Jun 12 2001 12:56 pm
Subject: Re: How to say: NOT using namespace std
Esa wrote: [SNIP] > I have defined in my code in the global scope: > using namespace std; > How do I turn it off, i.e. that I am not using namespace std anymore? There is no way. Don't use using namespace std; - it is evil. Name A [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ] You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.c++.moderated
From: jtb...@presby.edu (Jon Bell)
Date: 12 Jun 2001 12:57:04 -0400
Local: Tues, Jun 12 2001 12:57 pm
Subject: Re: How to say: NOT using namespace std
In article <f0gV6.1$22....@news.get2net.dk>, Esa <x...@y.z> wrote: Simply remove that statement. Then if you want to use any names from std, >I have defined in my code in the global scope: >using namespace std; >How do I turn it off, i.e. that I am not using namespace std anymore? you must either (a) prefix them with 'std::', for example: std::cout << "Hello, world!" << std::endl; or (b) name them in 'using' declarations: using std::cout; -- [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ] You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.c++.moderated
From: "Radoslav Getov" <nos...@mai.com>
Date: 12 Jun 2001 13:00:21 -0400
Local: Tues, Jun 12 2001 1:00 pm
Subject: Re: How to say: NOT using namespace std
: I have defined in my code in the global scope:
: : using namespace std; : : How do I turn it off, i.e. that I am not using namespace std anymore? : Impossible, but there is a workaround and advice: *never* use 'using Radoslav Getov [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ] You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.c++.moderated
From: Thomas Kunert <kun...@physik.tu-dresden.de>
Date: 13 Jun 2001 18:43:06 -0400
Local: Wed, Jun 13 2001 6:43 pm
Subject: Re: How to say: NOT using namespace std
Radoslav Getov wrote: What's wrong with it? In most cases it seems quite comfortable to write > Impossible, but there is a workaround and advice: *never* use 'using using namespace std; at the beginning of each source file that uses features from the Regards, [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ] You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.c++.moderated
From: Francis Glassborow <francis.glassbo...@ntlworld.com>
Date: 14 Jun 2001 01:05:05 -0400
Local: Thurs, Jun 14 2001 1:05 am
Subject: Re: How to say: NOT using namespace std
In article <3B275B62.A96F...@physik.tu-dresden.de>, Thomas Kunert
<kun...@physik.tu-dresden.de> writes >Radoslav Getov wrote: Yes, but in addition solutions should apply to other libraries and >> Impossible, but there is a workaround and advice: *never* use 'using >What's wrong with it? In most cases it seems quite comfortable to write >using namespace std; >at the beginning of each source file that uses features from the 'using directives are far too heavy. I would very much like to be able to write (particularly in header using namespace xyz; Now my question is 'how much more complicated does this make compiler Francis Glassborow ACCU [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ] You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.c++.moderated
From: Attila Feher <Attila.Fe...@lmf.ericsson.se>
Date: 15 Jun 2001 07:30:54 -0400
Local: Fri, Jun 15 2001 7:30 am
Subject: Re: How to say: NOT using namespace std
Francis Glassborow wrote: [SNIP] > Yes, but in addition solutions should apply to other libraries and [SNIP] > 'using directives are far too heavy. > I would very much like to be able to write (particularly in header > using namespace xyz; > Now my question is 'how much more complicated does this make compiler I suggets you do write it only to function bodies etc. where is it std::string Class::cnvStr( const std::string & s, const std::string } A [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ] You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.c++.moderated
From: Steve Clamage <clam...@eng.sun.com>
Date: 14 Jun 2001 00:59:02 -0400
Local: Thurs, Jun 14 2001 12:59 am
Subject: Re: How to say: NOT using namespace std
On 12 Jun 2001, Radoslav Getov wrote:
> "Esa" <x...@y.z> wrote in message news:f0gV6.1$22.962@news.get2net.dk... A using-directive might be OK if you restrict its scope. For > : I have defined in my code in the global scope: > : > : using namespace std; > : > : How do I turn it off, i.e. that I am not using namespace std anymore? > : > Impossible, but there is a workaround and advice: *never* use 'using example, you might create auxiliary namespaces for use in a primary namespace. Inside the primary namespace, using namespace auxiliary; is probably fine. But I agree that you never should put Unfortunately, many example programs in many textbooks Even in a toy program it is a simple matter to add a using- #include <iostream> int main() } If you forget one, the compiler will remind you. :-) --- [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ] You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.c++.moderated
From: jtb...@presby.edu (Jon Bell)
Date: 14 Jun 2001 11:47:02 -0400
Local: Thurs, Jun 14 2001 11:47 am
Subject: Re: How to say: NOT using namespace std
In article <Pine.SOL.3.96.1010612125722.12156D-100000@taumet>,
Steve Clamage <clam...@eng.sun.com> wrote: >But I agree that you never should put >Unfortunately, many example programs in many textbooks code from an earlier edition compatible with the standard. It's surely rather time-consuming to add 'std::'s to a lot of pre-existing code, and then check to make sure each program still compiles. -- [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ] You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
Newsgroups: comp.lang.c++.moderated
From: quux...@newsguy.com (quux111)
Date: 14 Jun 2001 20:16:09 -0400
Local: Thurs, Jun 14 2001 8:16 pm
Subject: Re: How to say: NOT using namespace std
jtb...@presby.edu (Jon Bell) wrote in news:GEwrJs.Dnr@presby.edu:
Putting std:: in front of simple pieces of code is needlessly messy, especially when a given code fragment uses only std:: elements. It's a fair practice if you write tutorial code -- I do it all the time in my documentation, but never in production code. I do agree that "using namespace blah;" is bad practice *in most cases* and [ Send an empty e-mail to c++-h...@netlab.cs.rpi.edu for info ] You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
| Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy |
| ©2009 Google |