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

Rémi Denis-Courmont remi at remlab.net
Wed Jun 24 12:10:19 CEST 2009

On Wed, 24 Jun 2009 11:20:27 +0200, jpd at videolan.org wrote:
> On Wed, Jun 24, 2009 at 09:42:17AM +0200, R??mi Denis-Courmont wrote:
>> Also many functions return error codes anyway, so the caller may be
>> handling the error even without a dummy exception parameter.
> Wasn't that why you could pass NULL instead of a valid
> pointer-to-exception-struct?
> While on it, a more general question (asked in general): Anything against
> changing libvlc_exception_raised to be static inline in the header?

We could. But I think this function is really useless, since you should get
the same information from the return value of the last call. Currently, it
is quite unclear whether the caller must check for exception, for returned
error, or both, or neither (some function cannot fail but still take an
exception parameter).

Now that the API and the ABI is broken in 1.1 anyway, I would much rather
remove the exception parameter everywhere, and:
- return error status for any function that can fail,
- store the last error "string" in the instance object or another, and
fetch it with a dedicated function.

That would get rid of the controversy altogether. It would also be nicer to
non-exception languages (no dummy parameter and calls) and to dynamically
linked bindings (one less structure layout through the ABI). In other
words, it would be better for pretty much everything except Python and OSX.

Rémi Denis-Courmont

More information about the vlc-devel mailing list