KColorScheme - additional (convenience) ctors

Matthew Woehlke mw_triad at users.sourceforge.net
Sun Sep 2 19:06:12 BST 2007


Simon Hausmann wrote:
> I suggest to change the signature of the constructor that takes a const 
> QWidget & to take a const QWidget *. Nobody passes around QWidget references, 
> so everyone using this constructor has to dereference the widget to pass for 
> no good reason IMHO.

Thanks for the feedback. I thought about that also, the problem is that 
passing a NULL reference is not valid. By requiring a reference rather 
than a pointer, this makes it explicitly clear that you must pass in a 
real object. Otherwise, the ctor has to either throw an exception or 
abort(), neither of which it currently does.

So I guess my preference is to make people type an extra '*' (and to 
force them to stop and think about what they're doing, which they need 
to be doing either way). But I'm willing to reconsider. Which evil is 
lesser?

-- 
Mathew
(sorry, .sig file is on the other computer)





More information about the kde-core-devel mailing list