Advice needed - gcc and exceptions

Linas Vepstas linas at
Wed Apr 26 17:34:03 CEST 2006

On Wed, Apr 26, 2006 at 01:27:25AM +0100, Jim White wrote:
> Is there an exception handling capability in gcc "C"
> (not C++) ???

No. But you can implement something simlar very easily 
in a few dozen lines of code, by pushing an error code 
onto a home-made stack ("throw"), and remembering to pop 
it every now and then in the caller ("catch"). "try" just 
clears the error stack.  (or rather, sets the current 
pointer in the error stack, so that pop/"catch" only pops 
to there.). Its not at all hard. 


More information about the gmp-discuss mailing list