Re: Quick question on Glib style/design



On Tue, 2004-03-08 at 10:06 +0200, Murray Cumming wrote:
> Surely you will still have to cast to a gpointer (void*) just as much as
> you would have to cast to A*, plus you'll have a totally obsure API. This
> is C, and casting is part of the deal with gobject. Get a better
> programming language if you want the language to do more work for you.
> 
> Something like gtk_widget_show(GtkWidget* widget) is an example of what
> you want. People always need to cast derived widget pointers (such as
> GtkTreeView*) to the base GtkWidget*, and people seem to have got used to
> doing that.

Actually the whole point of the email is that the compiler DOESN'T
complain when I pass an X pointer to a void pointer. Is the compiler
broken? Its GCC 3.3 on FC2.

As I said previously, gpointer works without making the user do the
casting. I'm not sure you read my email well, because I didn't say I
wanted the language to do the work for me, I said I wanted ME to do the
work for the user by doing the cast inside the function.

While the headers would look "obscure" the code would be more readable
since there is less redundant code. Clearly "foo_do_action" is designed
to worth with foo objects only.

> 
> 
> Murray Cumming

Cheers,
Ryan




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