[vlc-devel] commit: libvlc: Abort in case of unhandled exception. (Pierre d'Herbemont )

Rémi Denis-Courmont remi at remlab.net
Wed Jun 24 18:01:58 CEST 2009


Le mercredi 24 juin 2009 18:43:44 Pierre d'Herbemont, vous avez écrit :
> 2009/6/24 Rémi Denis-Courmont <remi at remlab.net>:
> > On Wed, 24 Jun 2009 07:14:23 +0200, Sébastien Escudier
> >
> > <sebastien-devel at celeos.eu> wrote:
> >> Quoting git version control <git at videolan.org>:
> >>> vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Tue
> >>
> >> Jun 23
> >>
> >>> 22:03:57 2009 -0700| [dfa5d0bac97b05b83ba493ecf5516c1af1fc0e72] |
> >>
> >> committer:
> >>> Pierre d'Herbemont
> >>>
> >>> libvlc: Abort in case of unhandled exception.
> >>
> >> Why ?
> >> exceptions are not always critical, and vlc can still run ok after an
> >> exception.
> >> So if the user choose not to handle some of them, I don't think we
> >> should abort.
> >
> > +1.
> > Also many functions return error codes anyway, so the caller may be
> > handling the error even without a dummy exception parameter. Really, this
> > exception thing might be cool to interface with higher-level languages,
> > but it just sucks for native applications.
>
> Point taken.
>
> I am not keen with this C exception stuff, it renders every C call
> painfull and add an extra line, in which most of the time we don't do
> any error handling.
>
> I have added this because I don't want to miss any error of this sort
> in the test for now.
>
> I am planning to add a way to override the default exception not
> handled handler. That would let us to do whatever we want with not
> handled exception.

I still don't see the point. The value of exceptions are: they have a message, 
they may have a type, they automatically unwind the stack and cleaning up in 
the process. In C, unwinding is not possible (except via long jumps or thread 
cancellation), and type data is not preserved at run-time. So the only thing 
left is the error message. In other word, the value (over a simple _optional_ 
get_error_message() function) of exception is simply nul.

And crashing the process because of unhandled exception is really stupid. It's 
just putting an incentive to pass a dummy exception buffer that is never 
checked. If you want to force the caller to handle exception, you're using the 
wrong language.

I stick to my point: exceptions are cool in languages that do implement 
exceptions. And only those.

-- 
Rémi Denis-Courmont
http://www.remlab.net/




More information about the vlc-devel mailing list