[vlc-devel] commit: New C++ binding for libvlc. ( Rémi Duraffort )

Olivier Aubert olivier.aubert at liris.cnrs.fr
Tue Jan 26 16:24:15 CET 2010


> > If you are really sure you want to use c++'s exception, I'd recommend
> > you inherit std::exception.
> > I like the use of the raii pattern for the exception :) that's pretty sexy :)
> About the use of exceptions I don't really know what to do:
>  * For the constructor that's cleaner to use exceptions.
>  * For the others functions I don't really know. That's easier to return
> error code this way but the applications using libvlc might want to
> ignore some. For example for the function MediaPlayer::lenght, how can I
> return an error without an exception (giving an argument for the error
> code is not really cleaner) ?
About the specific debate exceptions vs. return values, an interesting
discussion took place recently (on comp.lang.python, but its content was
not specific to python) :
Some academic and practical references about the subject are also given
in the discussion. To sum it up, as its name implies, an exception
should be used on exceptional codepaths only. For instance, we can
consider that MediaPlayer.length should not be invoked without checking
beforehand that an input is valid. Hence, an exception would be
appropriate here.

Back to the thread of libvlc bindings, I am ready to modify the python
binding generator code to also generate OO wrappers for java and C++
(for the moment, java generation only concerns the direct mapping of the
libvlc C API, not the OO wrapper generation). It would bring an exact
matching between APIs of different languages (thus help documentation)
and help keep the bindings up-to-date. However, since Rémi had a look at
the generator and eventually decided not to use it, I am not sure that
it would be adopted by java and C++ bindings maintainer. The decision is
up to them.


More information about the vlc-devel mailing list