On 6 September 2018 at 17:40, Thomas Huth <th...@redhat.com> wrote: > On 2018-09-06 16:50, Peter Maydell wrote: >> Nothing typically does, but the "modern" style of having QOM objects which >> use other QOM objects do so by embedding the child object's struct into >> the struct of the parent requires that the struct definition is available. > > But in this case we don't have anything that "inherits" from LSIState, > so shouldn't we rather follow the "information hiding" principle and > keep the state local to the lsi53c895a.c file? If you want to use a > "LSIState *" from another .c file, you can still put an "anonymous" > > struct LSIState; > typedef struct LSIState LSIState;
This doesn't work for typedef struct MySoC { MyUART uart; LSIState scsi; ... } MySoC; This isn't inheritance, it's just use ("has-a", not "is-a"). > in a header somewhere without revealing the implementation. > > I'm fine with putting the whole LSIState into a header file if we really > need it, but in this case, I don't see the point. Looking at the rest of the series there doesn't seem to be any code that wants to do use-by-embedding, so we can certainly postpone moving the struct into the header file until we need it. thanks -- PMM