Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] GTK2 Tree: build, patch, and one smoking shot

Boris wrote:
"Agreed in general (a lot of C code there that's WEIRD), but not in the
particular case of varargs.  How is
 
set_value(int, boolean)
set_value(int, int)
set_value(int, String)
 
with the appropriate C code (full signatures), weirder than
 
set_value_boolean(int, boolean)
set_value_int(int, int)
set_value_string(int, String)?"

That's not really addressing the vararg issue, only the issue of
wrapping GValues (which isn't too bad, I'll admit). 

The vararg problem is that the GTK function accepts a list of values of
undefined length (terminating in -1), or the same wrappered in the
va_list type (which is what a received digs out of a vararg call, but
isn't totally trivial to build). How do you want me to wrap this? Given
the constraints of the SWT APIs, only one value at a time can be changed
anyway, so IMO this is a bunch of functionally useless code since only
only column's value will be changed at once anyway in SWT (and hence
wrappering this by only accepting one value makes everything simpler).

The alternative is accepting an array to the function, unpacking the
array, and generating a va_list. This is going to be a hell of a lot
more complicated, error prone, and difficult to debug than accepting a
single argumument.

-Seth



Back to the top