Re: [PATCH 05/11] make red_pipe_item_init_full more typesafe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 23, 2016 at 07:54:03AM -0400, Frediano Ziglio wrote:
> Other part. You can find code where the parent is NOT the first
> field (for different reasons), I did some improvements on this.
> You can also find places were a class is "inherited" just to
> reuse some feature, so it's really likely when this class will
> evolve you can have this field replaced by something else or
> moved (for instance if you have a more strong parent class).

I would not expect the refcounting behaviour to move away from the base
class fwiw.


> Unfortunately this is the way RedPipeItem and other classes are
> used. For these cases I much more prefer having to add a possible
> ".base" wherever will be needed than spending hours of
> debugging (as I did) trying to figure it out which part of code
> is writing the field "xxxx" without using the "xxxx" name or
> even the "Yyyy" structure which contains "xxxx".

Ok, I understand your goal, however the way it's done in this patch is
that you get your static checks, but the fact that a RedCursorItem "is
a" RedPipeItem because of inheritance is totally muddied by some
construct one has to parse and understand first while reading the code.
If you make this 'cursor_item = SPICE_UPCAST(RedCursorItem, pipe_item)',
feel free to do the checking you want in the macro, but I don't want
these checks to make the code much harder to read.

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]