[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: c++ and gtk
- From: Dan Rosen <dr cs brown edu>
- To: gtk-app-devel-list redhat com
- Subject: Re: c++ and gtk
- Date: Mon, 14 Jun 1999 18:17:12 -0400 (EDT)
In my opinion, as long as you maintain a consistent convention within your
own code, you're not asking for any trouble using static members as
callbacks. My callbacks all take this form:
static foo callbackName(params, gpointer data);
...
foo Class::callbackName(params, gpointer data) {
Class* that = (Class*)data;
that->bar() // would be this->bar(), or just bar(), but you know...
that->myMember->baz() // etc...
...
}
It was pointed out that, rather than gpointer, which is just another name
for void*, you can just use Class*, and eliminate a line of code.
The only situation where you might be asking for trouble is if you're
working with a group of programmers with either their own conventions, or
idiosyncracies... But whatever. If you're sketched out about making your
own rules, use gtk-- (if not for its conventions, for its ingenious signal
system)...
Dan
> Yes, but static members can't call other non-static members of other
> classes.. In my experience you're just asking for trouble if you go too
> far with that..
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]