[vlc-devel] [PATCH 2/2] demux-run: Add input_source_t to es_out callbacks

Rémi Denis-Courmont remi at remlab.net
Mon Feb 8 09:25:19 UTC 2021

Le maanantaina 8. helmikuuta 2021, 11.05.06 EET Alexandre Janniaux a écrit :
> Hi,
> LGTM, though VLC_UNUSED would have been more usual.


VLC_UNUSED is plain dumb. That's the epitome of what I call the "premature 
portability" antipattern: abstracting or renaming some aspect of the 
programming environment even though there is yet only one implementation.

This comes in two variants:
1) whence there will only ever be one single implementation because it's 
actually already portable,
2) whence the abstraction ends up failing to accomodate for other 
And this manages to fail both ways. Casting to void is plain ISO C standard, 
and the definition of the VLC_UNUSED() macro precludes other means to mark a 
variable as unused (such as the C++ anonymous variables).

And I know, people have argued that it's clearer. But even that's not true. If 
you *write* non-VLC C code, you know that casting to void ignores unused 
parameters. You don't know VLC_UNUSED which is a VLCism. The macro may be 
self-explanatory when you *read* code, but it is not obvious when you *write* 
code. And this shows exactly here. Why should Tanguy and others after him have 
to learn a VLCism when there's already a standard way to do this?


More information about the vlc-devel mailing list