On Sun, Nov 28, 2010 at 04:04:34PM -0600, Anthony Liguori wrote: > >To create an object on the stack, you must have the class definition in > >a public header and a public constructor/destructor. > >This is exactly the same in C. > > It's really more of a design statement than a statement about C++ vs. C. > > In qdev today, we mix object initialization with a user-exposed > factory. This means that you cannot do something simple like: > > struct i440fx { > struct piix3 piix; > }; > > void i440fx_init(struct i440fx_init *obj) { > piix3_init(&obj->piix); > } > > But rather need to use ugly factory functions with all sorts of > DO_UPCAST. This is really unfriendly especially for writing test > cases. Yes, I agree. Just moving memory allocation out of there will fix most of the ugliness. -- MST -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html