Handling Exception

K

kullu.ashish

Hi all,
I want to know that what will happen if a C++ function called by a C
function (Suppose both are in different files one is a .cpp file and
other is .c file compiled and linked by g++ compiler) get some
unhandled exception ?
 
N

Noah Roberts

Hi all,
I want to know that what will happen if a C++ function called by a C
function (Suppose both are in different files one is a .cpp file and
other is .c file compiled and linked by g++ compiler) get some
unhandled exception ?

If they are both compiled by a C++ compiler then the exception is
propegated up the stack until it is caught or terminate is called just
like it always is. C++ has functions too and your "C function" in this
case is really a C++ function when compiled with a C++ compiler. So
nothing interesting happens.

I have no idea what happens when dealing with an actual C compiled
library that has no knowledge of exceptions. It's going to be outside
the scope of the C++ standard becasue a) you're now dealing with cross
language communication and the standard doesn't talk about that (beyond
syntatical compatibility) and b) the standard doesn't address linking
at all. What does the average compiler do? I don't know.
 

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,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top