Ok i have heard mixed comments about this. in books and my teacher say use it but i have heard a couple of people on boards that say don't use it. or the just use using std::whatever? so whats your opinion?
Opinion: Using Namespace Stdgood or not so good
Page 1 of 1
4 Replies - 7892 Views - Last Post: 07 July 2002 - 08:01 PM
Replies To: Opinion: Using Namespace Std
#2
Re: Opinion: Using Namespace Std
Posted 30 June 2002 - 01:34 PM
It doesn't really matter what type of using directives you use, as long as they're not in headers. If you create a library and distribute it to other people, and in one of your headers you write 'using namespace std;', then the entire std namespace is at global scope for anyone who includes that header. If someone uses your library and they have a class called 'list' (there's also a 'list' class in the std namespace, for those that don't know), there will be a name collision because of that using directive. Personally, I never use 'using' except at a confined scope (like in a function), and I don't think I've ever used using to pull the standard stuff out of the std namespace, I simply type 'std::' infront of everything I use from it.
#3
Re: Opinion: Using Namespace Std
Posted 02 July 2002 - 06:14 PM
Some other people's opinions on this (so far they all state what I basically feel, but more opinions may be posted):
http://www.gamedev.n...topic_id=102417
http://www.gamedev.n...topic_id=102417
#4
Re: Opinion: Using Namespace Std
Posted 07 July 2002 - 05:48 PM
i use it, just because i think it's better to do that then to go back to using iostream.h
i've never used it in a header before and that's good to know it's better off not using it. thanks.
i've never used it in a header before and that's good to know it's better off not using it. thanks.
#5
Re: Opinion: Using Namespace Std
Posted 07 July 2002 - 08:01 PM
well the alternative, just so you know, is kind of like this:
...and so on
using std::cin; using std::cout;
...and so on
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|