tech-userlevel archive

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

Re: Exceptions in C

On Mon, Nov 23, 2009 at 11:21:11AM -0500, der Mouse wrote:
> > Depending on how often you want to enter a exception handling context
> > ("try {}"), it can be expensive though.
> The gcc way will generally be substantially faster than longjmp; if
> nothing else, it doesn't involve a trap to the kernel.

E.g. on x86 no trap is involved. Other platforms might differ.
C++ exception handling is quite fast on modern platforms because it uses
additional side tables generated by the compiler to do the stack
unwinding and to find the exception handler. This makes the "try{}" part
essentially free and places the burden on the "raise".


Home | Main Index | Thread Index | Old Index