Reputation: 11
When we have simple condition (a<=b
), what is actually happening? Will it firstly compare a<b
, and if it's false will compare a==b
(a<b || a==b
)?
Upvotes: 0
Views: 66
Reputation: 222753
a <= b
evaluates to true (1) if and only if a
is less than or equal to b
. In typical C implementations, this determination is performed via a single machine instruction. If, for some reason, multiple instructions are needed, the C standard does not specify any ordering for them, just that the result is correct.
If a
and b
are expressions beyond simple identifiers, the C standard does not specify any ordering for evaluation of them, their parts, or their side effects due to the <=
operator, although there may be ordering constraints within the expressions.
Upvotes: 1