[vlc-devel] [PATCH 7/7] vout: display: pass the vout_display_priv_t directly in internal calls
Steve Lhomme
robux4 at ycbcr.xyz
Thu Oct 10 09:34:18 CEST 2019
On 2019-10-10 9:15, Thomas Guillem wrote:
>
>
> On Thu, Oct 10, 2019, at 08:45, Steve Lhomme wrote:
>> On 2019-10-10 8:29, Rémi Denis-Courmont wrote:
>>> And I disagree with the other patch too, so...
>>>
>>> This is totally against common practices for doing OOP-like code in
>>> non-OOP languages like C. You can't even do that sort of change in OOP...
>>
>> In C++ when you have callbacks it's common to cast the opaque pointer
>> back to the instance pointer and then call a method on the object. You
>> never call each internal function of the class with the opaque pointer
>> and cast it each time. This is exactly similar to what I want to avoid here.
>
> But it's not done like that in 90% of the VLC code base. We never decided to change it. I'm very fine with the current scheme.
>
> I already had to move back every functions from priv to public because of an API that needed more contexts (like, logging, variable...).
I don't think using casts because one day it may not be a cast anymore
is a good enough reason to use a cast.
>>
>>> Le 10 octobre 2019 09:15:00 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a
>>> écrit :
>>>
>>> On 2019-10-09 18:19, Rémi Denis-Courmont wrote:
>>>
>>> Hi,
>>>
>>> This feels very backward. We don't normally pass the private
>>> data. And the
>>> compilers are perfectly capable to optimize the back-and-forth
>>> conversion so
>>> the change is completely useless.
>>>
>>>
>>> container_of() is a glorified cast. One should not use cast unless
>>> there's no other option.
>>>
>>> This is exactly the same as was done in
>>> `a46508d9dd8eeccc8e8fa778b331f6c027db84c7`.
>>> ------------------------------------------------------------------------
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>
>>>
>>> --
>>> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser
>>> ma brièveté.
>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
More information about the vlc-devel
mailing list