The C operator precedence table has 15 precedence levels, from “++" down to “,"
(see https://en.cppreference.com/w/c/language/operator_precedence)

This is nuts.  I don’t remember them and I wouldn’t trust an engineer who claimed to.

Around 2005, when I was doing some chip verification, I found a hard to notice operator precedence bug (in VHDL, but it is the same issue) that would have cost us a half-million dollar mask spin.

If there is more than one operator, I use parens (I do write a[x] + b[x], that one I know.)

Our K-12 system isn’t doing us any favors when they think PEMDAS is “mathematics”.

-L

PS I’ve been a little angry about this since my 6th grader got marked down for using “extra” parentheses in class.


On Mar 9, 2025, at 19:12, Larry McVoy <lm@mcvoy.com> wrote:

Anyway, I frankly prefer to see explicit parens, so the precedence
is clear ??? it's easier to read and less error-prone for the maintainer.

This, a thousand times, this.  I taught my guys "think of coding as write
once, read many.  I could care less how much more work it is, write code
such that it is the easiest to understand".