if (dew && dew--) would win because it just feels right. |
This shouldn't win ever -- and it
certainly shouldn't feel right. It's very confusing and counterintuitive.
The parethesis part following an if statement is for a conditional statement. if that conditional statement is true, the {body} of the block following the condition is executed. it's a very simple structure:
1 2 3 4
|
if( some_condition )
{
Code_to_execute_if_condition_is_true();
}
|
Now ask yourself this: Is
dew--
part of the condition? No? Then it doesn't belong in the parenthesis. It's that simple.
Finding a clever way to work part of the executed code into the condition isn't clever, it's just code obfuscation. It does nothing but introduce possible bugs and make your code harder to follow. You really shouldn't be doing this kind of thing ever.
Why wouldn't you be able to decrement a bool? |
Because
conceptually it doesn't make any sense. Although I see your point -- and it does logically make sense since true and false are defined in C++ to be 1 and 0 respectively.
So yeah I halfway agree with you here so I won't get into it. However....
What I will say is that if the goal here is to make dew false... then
do the obvious.
dew = false
is obvious. Your intent is clear.
dew--
isn't as obvious becaue the intent depends on the previous state of dew.
No offense intended, but I think you need to take some lessons on code clarity. You seem to drift towards weird things that makes your code crazy hard to follow. The fact that you tried to cast pointer types so that you could decrement instead of just doing "= false" is kind of mind blowing.