using C library functions in C++

M

mthread

Hi,
I am learning C++ and already have a good experience in C. We have
some of the application in C which we want to move it to C++. Will
there be any issue in using a C library function in C++.


regards,
Rajkumar.G
 
N

Neelesh Bodas

Hi,
I am learning C++ and already have a good experience in C. We have
some of the application in C which we want to move it to C++. Will
there be any issue in using a C library function in C++.

regards,
Rajkumar.G

Appendix C.2 of the C++ standard discusses this issue in details. C++
provides a backward compatibility with most of the C headers, and
states that their usage is are deprecated. There are few changes
introduced - eg. Declarations of certain functions like strchr and
strstr have been changed, behavior of atexit(), exit(), abort(),
longjmp() is changed, etc.

-N
 
M

mthread

Appendix C.2 of the C++ standard discusses this issue in details. C++
provides a backward compatibility with most of the C headers, and
states that their usage is are deprecated. There are few changes
introduced - eg. Declarations of certain functions like strchr and
strstr have been changed, behavior of atexit(), exit(), abort(),
longjmp() is changed, etc.

-N

thank you
 
E

Earl Purple

Appendix C.2 of the C++ standard discusses this issue in details. C++
provides a backward compatibility with most of the C headers, and
states that their usage is are deprecated. There are few changes
introduced - eg. Declarations of certain functions like strchr and
strstr have been changed, behavior of atexit(), exit(), abort(),
longjmp() is changed, etc.

-N

The use of the headers is deprecated. So you should use <cstdio>
instead of <stdio.h> but the functions themselves are not deprecated
so you can use strlen if you want, albeit that it is now in namespace
std and you should call std::strlen

I believe though that in <ctype> you should use ::toupper
and ::tolower because std defines different versions of these in
<locale> (not just overloads) so the original functions are not in
namespace std. Not sure what exactly is the issue, as I've never used
locale and it never really does what I would like it to do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,048
Members
47,649
Latest member
MargaretCo

Latest Threads

Top