[vlc-devel] [PATCH 2/2] demux-run: Add input_source_t to es_out callbacks
robux4 at ycbcr.xyz
Mon Feb 8 10:54:50 UTC 2021
On 2021-02-08 10:25, Rémi Denis-Courmont wrote:
> Le maanantaina 8. helmikuuta 2021, 11.05.06 EET Alexandre Janniaux a écrit :
>> 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?
For the record:
VLC_UNUSED 1141 occurrences among 307 files
(void) 1140 occurrences among 347 files
More information about the vlc-devel