Here is some code to check that a value falls in between a range
if((i <= n) && ( (i+m) >= n){
//do something.....
};
This is basically a Boolean AND condition, and if both operands are true then the outcome of the condition is true. However with short circuit evaluation C++ only tests to see if the first condition is true, and if so, then it never checks whether the second condition is true. In the proper mathematical sense how is this a Boolean test? This totally deranges the logic of my code and instead I had to write it like this:
if( (i <= n){
if((i+m) >= n){
//do something......
}
}
What is the sense of short-circuit evaluation, and how can I make C++ do a proper Boolean test without using nested if conditions.