|
-
June 11th, 2009, 12:30 PM
#16
Re: If Statement && Help
 Originally Posted by KingTermite
if ( (GetAsyncKeyState(VK_F8) && x ) > 1)
Would this ever be true? I think (a && b) returns either 0 or 1, never >1.
-
June 11th, 2009, 12:37 PM
#17
Re: If Statement && Help
 Originally Posted by KingTermite
is this supposed to be:
if ( (GetAsyncKeyState(VK_F8) && x ) > 1)
or
if (GetAsyncKeyState(VK_F8) && (x > 1) )
Compiler probably doesn't know? You have two evaluations there.
That wouldn't be ambiguous to the compiler.
-
June 11th, 2009, 01:46 PM
#18
Re: If Statement && Help
 Originally Posted by GCDEF
That wouldn't be ambiguous to the compiler.
Neither one is ambiguous to compiler. For the programmer – may be.
Compare operators have higher precedence than logical AND.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
June 11th, 2009, 02:18 PM
#19
Re: If Statement && Help
 Originally Posted by w3rd
Would this ever be true? I think (a && b) returns either 0 or 1, never >1.
I thought a && b returns true or false. i'm not sure that true is equivalent to 1
-
June 11th, 2009, 02:22 PM
#20
Re: If Statement && Help
 Originally Posted by Amleto
I thought a && b returns true or false.
That is true in C++.
 Originally Posted by Amleto
i'm not sure that true is equivalent to 1
true is converted to 1.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|