rondino rondino - 3 months ago 8
C Question

order of evaluation of comparison operator?

I have learnt that logical operator are guaranteed that their evaluation are from left-to right but I was wondering what are the order of evaluation of comparison operator. For instance

expression1 < expression2
in other words is it guaranteed that
expression1
will be first evaluated before
expression2
.

Answer

According to the standard:

J.1 Unspecified behavior

The following are unspecified:
....

— The order in which subexpressions are evaluated and the order in which side effects take place, except as specified for the function-call (), &&, ||, ?:, and comma operators (6.5).

Comments