Re: GNOME GTK-- Projects

On Mon, 1 Jun 1998, Erik Andersen wrote: 
> On Mon, 1 Jun 1998, Michael Hudson wrote:
> > There's no guarantee that would work, because the exceptions would have to
> > propogate through gtk code, which is in C, not C++. It might work with
> > gcc/g++, but it might not work everywhere. (it wouldn't work using
> > CodeWarrior on the Mac, not that that's an issue here, just an example
> > that it _doesn't_ always work).
> > 
> > Michael Hudson

[ a nice idea for configurable error handling elided ]

> Anyway, with something like this in place, anybody writing an application
> (or a wrapper library) could then simply write their own error handler 
> function.   For example, Gtk-- could write an error handler that looks like:
> void GTKmm_GTK_Error_Handler(GtkErrorStruct error)
> {
> 	throw (error);
> }
> which will get called by gtk+ when an error occurs.   It is then very easy 
> to modify the Gtk--.m4 macro to ensure that the right thing is done by the 
> compiler WRT exceptions to ensure that this is handled.
>  -Erik

Did you read my post?
If not why did you quote it?
Unless you compile GTK+ in C++, there's no guarantee that exceptions will
be able to propgate through the GTK+ code.
At the point of call of your GTKmm_GTK_Error_Handler above the stack is
likely to look like this:

gtk_widget_whatever          **
_gdk_internal_gubbings       **

The functions marked ** will have been compiled as C, so when 
GTKmm_GTK_Error_Handler throws an exception, you can't say what's going to
happen. What worst is this will probably work - most of the time.

This isn't to say configurable error reporting isn't a very, very good
idea, but C and C++ don't always mix perfectly.

Michael Hudson
Jesus College

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