| I wish to learn c++ from knowing c. i have documentation relating to c
| library functions but what is the c++ equivalent and where can i find it?
Some possible free documentation sources:
A free but out-of-date C++ standard defining all the libraries
can be found at: ftp://ftp.research.att.com/dist/c++std/WP/CD2/
The documentation of the library that comes with GNU C++
is available at:
http://gcc.gnu.org/onlinedocs/libstdc++/documentation.html
SGI STL:
http://www.sgi.com/tech/stl/
Has an introduction, and docs for the algorithms and container library,
but nothing about the iostreams library.
Watch out for non-standard extensions that are included in
the documentation (e.g. all the hash_* containers are non-standard).
The online documentation of a commercially available library
can be found at
http://www.dinkumware.com/refxcpp.html
For more general resources and books, see also my recent post:
http://groups.google.com/[email protected]
| Also, is there any restriction in using the libraries i am used to using
in
| c programs in c++ programs?
No. But there are two key differences you need to take into
account to write standard-compliant C++ code:
1) #include <c*****> instead of <*****.h>
#include <cstdlib> // not #include <stdlib.h>
The C-header include will work on many platforms,
but is not portable.
2) All C library names (except a few macros) are in
the std C++ namespace. So you should write:
std:
uts("hello"); //NOT: puts("hello");
Initially, you can remedy to this by adding a
single directive in your programs:
using namespace std; //rarely a good idea in real code
I hope this helps,
Ivan