It saves you from having to learn those pesky boolean operators...
if( ((input1 < '1') && (input1 > '9')) || ((input2 < '1') && (input2 > '9')) ) return INPUT_ERROR;input1 -= 48;input2 -= 48;if( ((input1 < 1) || (input1 > 9)) || ((input2 < 1) || (input2 > 9)) ) return INPUT_ERROR;
TGV:If you read carefully, you'll see that the code was not exactly reused. The condition in the first if-statement always fails.
belgariontheking:What if it's double threaded and those two values change between the evaluation of whether they're less than 1 and greater than 9?
strcmp:you have to declare the variables volatile for that to happen
Spectre: strcmp:you have to declare the variables volatile for that to happen How do you know they aren't declared volatile in that snippet?
Spectre:they aren't declared volatile in that snippet
strcmp: Spectre: strcmp:you have to declare the variables volatile for that to happen How do you know they aren't declared volatile in that snippet? Easy: Spectre:they aren't declared volatile in that snippet
: IF COMPILE ?-GOTO COMPILE-HERE ; IMMEDIATE: THEN HERE SWAP ! ; IMMEDIATE: ELSE COMPILE GOTO COMPILE-HERE SWAP HERE SWAP ! ; IMMEDIATE
operator<( const InputType& i, const char& c ) { return rand() < int(c); }
operator<( const InputType& i, const int& n ) { return int(i) < n; }