On Thu, Jul 05, 2012 at 12:15:04PM +0200, Andreas Färber wrote: > Am 05.07.2012 11:53, schrieb Paolo Bonzini: > > Il 05/07/2012 00:34, Andreas Färber ha scritto: > >>>> Just to clarify: replacing upcasts which are always safe > >>>> with downcasts which can fail is what I consider especially ugly. > >> As per Anthony the parent field in the QOM instance structs is not > >> supposed to be touched (cf. object.h). We mark it /*< private >*/ so > >> that it doesn't even show up in gtk-doc documentation. If it is unused, > >> its name becomes irrelevant and could even be "reserved" if we so > >> wanted. Renaming it to whatever proves that all old references are gone. > > > > I disagree with removing static checks whenever possible. > > > >> Background is that qdev and QOM work differently with regards to > >> inheritance: as mentioned in the preceding patch, for qdev the parent > >> was (had to be) identified by name and could be anywhere in the struct; > > > > Not entirely true, being at the beginning of the struct is already > > enforced by using DO_UPCAST (which is admittedly a strange name for a > > downcast macro) instead of container_of. > > If you look at the patchset you will find that it was not properly enforced! > > Andreas
Yes DO_UPCAST is IMO evil and should go - everyone can eiter use dynamic QOM types with lookup by name; or stop passing nonsafe void * pointers around and use container_of consistently. > -- > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg >
