dsound: Avoid implicit cast of interface pointer. [RFC]

Henri Verbeet hverbeet at gmail.com
Wed Mar 16 07:42:37 CDT 2016


On 16 March 2016 at 05:46, Sebastian Lackner <sebastian at fds-team.de> wrote:
> To catch errors like http://source.winehq.org/patches/data/120308 easier in the future,
> I would like to propose, that we replace CONTAINING_RECORD and similar macros with a
> typesafe definition (on compilers where this is possible). The linux kernel source
> contains an example how to do that, but there are multiple solutions available:
>
> #define container_of(ptr, type, member) ({                      \
>         const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
>         (type *)( (char *)__mptr - offsetof(type,member) );})
>
> One disadvantage is that we'll have to add explicit casts to a couple of places, like below.
> Other dlls which would require explicit casts at a couple of places:
>
> amstream, d2d1, d3d11, d3d8, d3d9, ddraw, dwrite, msxml3, oleaut32, quartz, rpcrt4, vbscript
>
That implies you've tried the change. Did you find any issues other
than the one in 120308? If not, I think this is rarely an issue in
practice and not worth making legitimate cases uglier for.



More information about the wine-devel mailing list