This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to make it working correct(libstdc++)?


On Mon, Aug 12, 2002 at 11:48:40AM +0300, Christoph Bugel wrote:
> You should write it this way:
> 
> #include <iostream>
> #include <string>
> using namespace std;
> 
> int main()
> {
>   string str("hello world!");
>   cout<<str<<endl;
>   return 0;
> }

It's time to stop recommending "using namespace std;" in user code.  
The standard library defines far too many names for people to be 
expected to remember them all.  The canonical program is better
expressed as:

#include <iostream>
#include <string>

int main()
{
  std::string str("hello world!");
  std::cout << str << std::endl;
  return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]