[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using namespace std; needed in tagdemo

From: Bob Friesenhahn
Subject: Re: using namespace std; needed in tagdemo
Date: Wed, 1 Sep 2004 23:07:31 -0500 (CDT)

On Thu, 2 Sep 2004, Peter O'Gorman wrote:

I decided to run "make check" on darwin with xlc++ as CXX and xlc as CC, all the C tests passed fine, I guess I never tested c++ before (oops!) as tagdemo fails. main.cpp and foo.cpp need a "using namespace std;" or need to change cout to std::cout and endl to std::endl.

Problem is that I'm not sure if/how this change will affect older compilers.

Thoughts? Answers?

Compilers which do not support namespaces at all will be sunk. GCC has supported namespaces for quite a while now (since the early egcs days) but since libstdc++ implementation lagged, it defaulted to making std:: the same as global scope. That means your code would compile.

I have had C++ open source software deployed since 1998 and the only problems I encountered with namespaces is with accidentially writing code which did not respect them (due to primarily using GCC).

So, in my opinion, it is safe to use these standard C++ features.

Bob Friesenhahn

reply via email to

[Prev in Thread] Current Thread [Next in Thread]