Quick question on Glib style/design



Hello,

I have a simple object hierarchy A<-B, and some base functions that take
A* as a parameter:

do_base (A*)

Currently I have to cast B to A so I can use do_base because the C
language doesn't know about my hierarchy. Since I'm forced to cast
anyways, I was thinking of changing the functions to:

do_base (gpointer)

then casting gpointer to A inside.

The declaration in the header will look weird, but it saves the
programmer from manually casting. 

I want MY functions to do the casting (which is unavoidable anyways),
but the dang compiler won't stop complaining!

Is this a good idea? Clearly its not extensible to more involved
hierarchies since I'll have nothing but gpointers.

Cheers,
Ryan




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