[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: [flake] KoDef refactor.
From:       Thomas Zander <zander () kde ! org>
Date:       2006-04-27 17:49:10
Message-ID: 200604271949.11620.zander () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Thursday 27 April 2006 17:19, Thorsten Zachmann wrote:
> -        if(event->m_event.buttons() & Qt::LeftButton == 0)
> +        if( !( event->m_event.buttons() & Qt::LeftButton ) )

I didn't spot this when I replied; but I want to comment that the above is 
wrong.  Well, not really wrong, see it gets through the compiler.
But more correctly stated, it is highly confusing as the change makes the 
binairy and look like the result is a boolean. Which it is not.  Normally 
not directly a biggy; but its easy to mix up & and &&.
The result actually is an integer (an enum actually).

So, when doing a binairy and (the single &) the only two correct options 
are:
 buttons() & Qt::LeftButton == Qt::LeftButton
or
 buttons() & Qt::LeftButton == 0

You can naturally be creative and use an != 0, but I digress.

Remember; code gets written ones, but read many times :)

Thanks for your attention! Now back to the regular scheduled threads.
-- 
Thomas Zander

[Attachment #5 (application/pgp-signature)]

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic