VD> I'd write instead:
VD> void MouseInfo::setButtons(int but)
VD> {
VD> installed = (buttons = but) + 1 ? False : True;
VD> }
I wouldn't.
Not only is the "installed" member variable redundant, as I wrote here
some time ago, but I also think that your proposal is very bad style:
- use operator! instead of ?: (?: is ok, but not here):
installed = !((buttons = but) + 1);
- if comparing against -1, say so:
installed = (buttons = but) != -1;
- don't use the result of an assignment like this (any decent compiler
is right to issue a warning):
buttons = but;
installed = buttons!=-1;
Now the code looks like what a human (me!) thinks when writing it. On
a compiler worth its money, the resulting object code should be
exactly the same (if False and True are reasonably defined).
Thomas
---
þ MM 1.0 #0113 þ When you don't know what you're doing, do it neatly
---------------
* Origin: McMeier & Son BBS (2:301/138)
|