samspade
Member
I've been looking into some of the basics of GML recently and when I was looking at operator precedence I came across this page in the manual: Expressions. It claims that: "When doing multiple operations in a single expression, it is very important that you use brackets () to separate out the order of operation, as different platforms may perform them differently if not explicitly stated in this way."
This makes some sense, however, it goes on to add that:
That seems ridiculous. The only reason for the middle one being better is if this is a possible evaluation of the first line:
Is it really this undefined? I would have assumed there was at least some consistency for order across all platforms on basic stuff like assignment or comparisons. For example:
This makes some sense, however, it goes on to add that:
Code:
a = b == c || d;
a = (b == c || d); //better
a = ((b == c) || d); //best
Code:
(a = b) == c || d;
Code:
//would this ever be evaluated as
if 5 * 2 == 10 * 1 {
}
//this
if 5 * (2 == 10) * 1 {
}