LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-19-2007, 07:56 AM   #1
santana
Member
 
Registered: Sep 2004
Distribution: FC, ubuntu, OpenSuse
Posts: 112

Rep: Reputation: 16
how to get an inventory of what's in namespace std??


Hi, I originally learned using ansi c, but now that I am using c++ alot of that original c functionality is included in namespace std. Besides grep'ing sources, does any one know of a list of everything in namespace std?? or how to generate one programatically??
 
Old 03-19-2007, 08:55 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
The C functions that are available in C++ are defined in the C++ standard. Looking at my version there are 102 standard functions (in 18 header files) The standard states that the header file will place the contents in the std namespace but there will be a copy of each header file that start with the letter c, for each of these the contents will be global (that is a using namespace std is inserted). Hence stdlib.h will have the functions in the std namespace whilst cstdlib.h will be global.

Just an aside, if you are using a lot of C functions then maybe you're not using C++ properly.
 
Old 03-19-2007, 05:02 PM   #3
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
For a more friendly view of its contents, check out SGI. It outlines quite a few additional concepts that aren't specifically defined in code, such as what the different types of iterators and containers need to provide.

Some compilers place C functions in std:: when included in C++, others don't, and others have a mix. I would count on them not being in std:: unless you get a compiler error, in which case you can using std:: locally in a function/scope. Some of the C headers have C++ names (like <cstdlib> for <stdlib.h>, and others don't (I don't recall all of them.)
ta0kira

Last edited by ta0kira; 03-19-2007 at 05:04 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
namespace vs classes in C++ xeon123 Programming 3 02-18-2007 03:08 AM
Namespace Question joelhop Programming 3 08-23-2006 10:28 AM
What is "using namespace std"? NCC-1701&NCC-1701-D Programming 1 06-29-2005 08:56 AM
`cout' undeclared in namespace `std' aw_wolfe Programming 1 04-30-2005 09:25 PM
Understanding Namespace? nny0000 Programming 2 12-22-2003 08:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration