General performance question

Hello, I've got a simple question: In gtkmm, when I want to set a boolean property of any object, like a widget, and I don't know it's current state, should I first check if the state isn't how I want it to be, or should I always call set? For example, in the case I want a widget to get insensitive, would I write:

    if(widget.get_sensitive()) widget.set_sensitive(false);

or only


And if it doesn't have a significant influence on the performance, which one would you consider the better style?


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