[MPlayer-dev-eng] [PATCH] libbs2b audio filter

Andrew Savchenko bircoph at gmail.com
Sat Mar 28 04:21:35 CET 2009


Hi,

On Wednesday 25 March 2009 23:03, Reimar Döffinger wrote:
[...]
> IMHO you should reconsider your conclusion of "ugly". Or would
> you refuse to use exceptions in C++?

No, but:
1) I try not to use C++ whenever it is pollible to use plain C.
2) Exception is C++ language feature, and I do not use goto in C++, 
though it is technically possible. Even if both thouse 
instructions may result in the same assembly code.

> The kernel developers allow/recommend goto as well for that kind
> of cleanup operation, for this same reason, there is no really
> comparably maintainable way to do cleanup.

Yep, I aware of this, I worked with some kernel subsystems quite 
time ago.

> Within MPlayer there 
> has been (and probably still is) quite a bit of code that shows
> the price of avoiding it too much.
> That said, it is a good idea to think about which uses of goto
> are likely to lead to chaos and which seem overall reasonable
> and not use it carelessly, but that applies to almost
> everything, there are ways to get the same effects as a goto
> without using it, and they are truly scary...

I admit, in rare cases goto is a good solution, but not it this 
one. Please note: cleanups with all sanity checks are already 
implemented as uninit functions. So IMO the best solution in 
particular case of libaf will be to call uninit function if an 
appropriate error code from af_open is returned. Perhaps the best 
choise for return code will be AF_FATAL due to severe nature of 
memory allocation problems. However, special code of mask like 
AF_CLEANUP may be introduced.

-- 
Best regards,
Andrew
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20090328/d7328f78/attachment.pgp>


More information about the MPlayer-dev-eng mailing list