Padding public structures to avoid ABI breakage




Hi,

first, happy 2011 to everyone here :)

now, I'd like to start working on padding our public structures to avoid continuous ABI breakage.

I've been checking how some other projects are doing this (checked GStreamer and GTK+), both pad the class structures, however GStreamer pads (almost) all public data structures while GTK+ does not. I think in our case it is better that we do as GStreamer because structures like *Spec are subject to change and break ABI, for example. I guess GTK+ is confident on only using private structures for the object's data and that is why that solution would work well for them.

I would not care about trying to optimize padding for any particular architecture. Also, AFAICS, neither GStreamer nor GTK+ attempt to do that.

As for how much padding we should use... GTK+ is using sizeof(void *)*4, while GStreamer is normally using sizeof(gpointer)*20 (They have 2 different padding types, but they mostly use this one AFAICS). Given that we are still in an early stage and we should expect API additions now and then, I guess we could go with something like GStreamer for most of our public objects, like GrlMediaSource and the like, but we could be more restrictive with GrlData instances, (like GrlMedia), since there can be lots of these and the memory footprint can be noticeable bigger in case we go with a big padding for them. Also, I think we should not need to add that much API to GrlData instances in the future (I mean new vmethods, other kind of API would not break ABI), but I could be wrong.

Before I get started with this, if you have any advice, suggestion or opinion on this topic, let me know.

Iago




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