Compiler warning I don't understand

Started by
2 comments, last by NogginBoink 20 years, 3 months ago
I can't understand why the compiler doesn't like this statement:

void CBox::SetDebugState(DWORD newState)
{
	m_CBOX_DRAW_WIREFRAME = ((newState || CBOX_DRAW_WIREFRAME) > 0);
}
  
I just want to set m_CBOX_DRAW_WIREFRAME to true or false, depending on the bitmask flags in newState. Logically, the expression makes sense to me, but the compiler warns: c:\path\cbox.cpp(307) : warning C4804: '>' : unsafe use of type 'bool' in operation What's that warning mean and how do I fix it? [edited by - NogginBoink on January 4, 2004 12:39:45 PM]
Advertisement
DOH!

Never mind. I was using logical-or (||) instead of bitwise-or (|).

Changing to bitwise or (which is what I had intended to begin with) solved the problem.
I think you wanted:
m_CBOX_DRAW_WIREFRAME = newState & CBOX_DRAW_WIREFRAME;
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
*sigh*

Yep. You''re right.

Time for me to go back to bed.

Thanks.

This topic is closed to new replies.

Advertisement