Thread: using namespace std;

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572

    using namespace std;

    hey guys, can someone explain the difference of declaring namespace right below the library
    Code:
    #include <iostream>
    using namespace std;
    and using the std:: in the code it self?
    Code:
    std::cout << "Hello, World!" << std::endl;
    is this compiler specific, and is there a standard? I have two books, "Absolute C++" by Savitch whitch teaches the decleration of 'using namespace std;' and "Accelerated C++" by Koenig and Moo whitch starts of with std::

    thankx,

    axon

    ----edit----
    I use VC++ 6.0, and both ways work, but the authors of accelerated c++ say that things such as
    Code:
    using std::vector
    vector<double>::size_type n = 0;
    does not work, and displays and error message
    Last edited by axon; 03-05-2003 at 05:53 PM.

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why std:: and not using namespace std?
    By swappo in forum C++ Programming
    Replies: 4
    Last Post: 07-03-2009, 03:10 PM
  2. std:: or namespace std
    By C-+ in forum C++ Programming
    Replies: 16
    Last Post: 12-04-2007, 12:30 PM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. need ; before using namespace std
    By wwfarch in forum C++ Programming
    Replies: 7
    Last Post: 05-11-2004, 10:42 PM
  5. Site tutorials
    By Aalmaron in forum C++ Programming
    Replies: 20
    Last Post: 01-06-2004, 02:38 PM