Re: Does g++ really need to compile main, if c++ code is involved?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20 March 2014 15:50, Eric Wolf wrote:
>
> I really think, static initializations and exceptions are the problem,
> because if I placed main in a C source file and compile it with gcc,
> how are the initializations done? How are uncaught exceptions handled?

Using the DWARF-based exception mechanism the compiler looks up the
stack for a suitable catch handler and if none is found (either
because the higher stack frames are C++ functions but don't catch the
exception, or because they are not C++ functions at all) then
std::terminate() is called at the throw site.

So I believe an uncaught exception will terminate the process
irrespective of what language main() is written in.

Global ctors/dtors are a separate issue, I'm not sure how they're
handled if main() isn't written in C++.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux