Re: Return values from gtk2 widget (void) methods



Hi Goran,

goran kirra net wrote:

My 2 cents:
1. With void functions we normally don't know if it was
   successful or not.
Yes, I haven't used gtk/gtk2 in C but surely there must be a way to tell 
if an error has occurred?

2. On the other hand it would be nice to have a consistant
   return value scheme like "0 (zero)"=failed, "not 0"=success
   so we could do perlish things like:
   $obj->set_label('xx') && $obj->show;
I reckon that undef is better for failure as it is not the same as 0.
eg 0 is returned by gtk_window_get_resizable when the window is not
resizable (false) - but it represents a successful function call.
 
Anyway the interface should be constistant and
Agreed :)

the test suite should check that it is.
This is simple to check if the returned value is 'defined' for success
and can be

1) A ref - to a widget or an event
2) A value - 0, 1, 26, 'Label text'
3) Any other defined value like true/false

Best regards, Dermot





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