HaxeFoundation/HaxeManual

Operator precedence

neillrobson opened this issue · 1 comments

On the following line of documentation:

\item \expr{\%} have lower precedence than \expr{*} and \expr{/} whereas in C these three have the same

% have lower precedence than * and / whereas in C these three have the same

I may be misunderstanding the definition of the word "precedence" here. My understanding is that lower precedence means that the operator would be executed later in the sequence of expression resolution. In this issue on the main Haxe repository, it seems as though modulo has a higher precedence according to this definition. Indeed, modulo is listed above multiply/divide in the table which is stated to be ordered in descending precedence.

The same could be said for the bitwise operators mentioned two lines below (they are higher, not lower precedence than comparison operators).

Am I misunderstanding the documentation? If not, I will go ahead and submit a PR fixing this issue.

Simn commented

Yes that seems backwards...