<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>As far as I can see QFlags is used only on enums that support bitwise operation, i.e. that are defined as 1, 2, 4, 8, etc. So it is impossible to produce an invalid enum value using bitwise operations. As I said, QFlags exists only because C++ accepts an integer where an enum value is required thus violating type safety - a drawback C# does not have with its enums, that is, calling MyMethod(MyEnum myEnum) with an integer (or a short, long, etc.) fails to compile. So, if C++ enums were type-safe as C# enums, there would be no QFlags because it'd serve no purpose. And then the one difference between a working and a non-working flags enum would be that the first one is correctly (1, 2, 4...) defined.</span></div><div><span>Thank you for your opinion on the matter, I appreciate it. I also appreciate your sample
 implementations but I want the generated API to be, besides correct, as simple as possible.<br></span></div><div><span><br></span></div><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Richard Dale <richard.dale@telefonica.net><br> <b><span style="font-weight: bold;">To:</span></b> KDE bindings for other programming languages <kde-bindings@kde.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, April 9, 2012 11:35 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Kde-bindings] Qyoto: new features<br> </font> </div> <br>
<div id="yiv776759489">
<style type="text/css">
#yiv776759489 p, #yiv776759489 li {white-space:pre-wrap;}
</style><div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px;">On Monday, April 09, 2012 01:27:35 PM Dimitar Dobrev wrote:<br></div>
<div style="margin-top:12px;margin-bottom:12px;margin-left:40px;margin-right:40px;text-indent:0px;">It works because while QFlags are not technically enums, they do nothing but provide type safety for C++ enums, that is, practically they are enums. On the C# side, enums are natively type-safe so it is completely correct to replace QFlags with Enum. </div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px;"><br><br>Well no I don't think that's right. If you pass 'EnumA & EnumB' as a argument that value isn't an enum, it is an unsigned int. The QFlags stuff is about constructing unsigned ints from enums that are AND'd and OR'd together in a type safe manner.</div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px;"> </div>
<div style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px;">-- Richard</div></div></div><br>_______________________________________________<br>Kde-bindings mailing list<br><a ymailto="mailto:Kde-bindings@kde.org" href="mailto:Kde-bindings@kde.org">Kde-bindings@kde.org</a><br><a href="https://mail.kde.org/mailman/listinfo/kde-bindings" target="_blank">https://mail.kde.org/mailman/listinfo/kde-bindings</a><br><br><br> </div> </div>  </div></body></html>