[vlc-devel] [PATCH 5/5] variables: warn when a variable is created twice in the same object
Steve Lhomme
robux4 at ycbcr.xyz
Mon Mar 16 08:42:48 CET 2020
On 2020-03-13 16:39, Rémi Denis-Courmont wrote:
> Le perjantaina 13. maaliskuuta 2020, 16.00.32 EET Steve Lhomme a écrit :
>> Only in debug builds.
>
> At this time, variables are reference counted. There is still code that
> depends on this. I'm not saying that it's a good thing - I would not have
> designed it like that personally.
>
> But it is what it is, and until somebody goes through the pain-staking work of
> reviewing the whole code base for potentially multiply referenced variables,
> then we have to keep it that way.
This is not what this patchset it about. We have the same variable on
the same object created twice in a few places. They don't share their
reference counter.
> We don't start warning until we have made a honest effort at not triggering the
> warning. Preferably, we don't warn at all and we instead redesign the API so
> that you can't get it wrong, or it'll fail at build time.
We have plenty of code that warns an API is deprecated without any
"honest effort" on fixing the issue. I don't think hiding hazardous use
of pointers knowingly is a good practice. In this particular case the
issue can only be found out at runtime. Once/if we fix the dual
command-line creation we can turn this into an assert.
More information about the vlc-devel
mailing list