Typos / weirdness in QFlags default arguments

Adriaan de Groot groot at kde.org
Sun Aug 19 00:32:36 BST 2007


In kdelibs methods that take QFlags arguments with a default, like so (from 
kdeui/):

void setShapeGesture(const KShapeGesture& gest, ShortcutTypes type = 
static_cast<ShortcutType>(ActiveShortcut | DefaultShortcut));

there seem to be two things wrong: the static cast to ShortcutType instead of 
ShortcutTypes and the fact that static cast is being used at all. Is there a 
good reason to avoid

ShortcutTypes(ActiveShortcut | DefaultShortcut)

or

QFlags<ShortcutType>(ActiveShortcut) | QFlags<ShortcutType>(DefaultShortcut)

here? I vaguely recall there being compiler issues with templated default 
arguments a year or more back; there's certainly compiler issues with the 
existing static casts.

-- 
These are your friends - Adem
    GPG: FEA2 A3FE Adriaan de Groot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070819/b59adc73/attachment.sig>


More information about the kde-core-devel mailing list