<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">The C operator precedence table has 15 precedence levels, from “++" down to “,"<div>(see <a href="https://en.cppreference.com/w/c/language/operator_precedence">https://en.cppreference.com/w/c/language/operator_precedence</a>)<div><br></div><div>This is nuts. I don’t remember them and I wouldn’t trust an engineer who claimed to.</div><div><br></div><div>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.</div><div><br></div><div>If there is more than one operator, I use parens (I do write a[x] + b[x], that one I know.)</div><div><br></div><div>Our K-12 system isn’t doing us any favors when they think PEMDAS is “mathematics”.</div><div><br></div><div>-L</div><div><br></div><div><div>PS I’ve been a little angry about this since my 6th grader got marked down for using “extra” parentheses in class.</div><div><div style="display: block;"><div style="-webkit-user-select: all; -webkit-user-drag: element; display: inline-block;" class="apple-rich-link" draggable="true" role="link" data-url="https://larry.stewart.org/2010/12/05/order-of-operations-evil-and-pernicious/"><a style="border-radius:10px;font-family:-apple-system, Helvetica, Arial, sans-serif;display:block;-webkit-user-select:none;width:300px;user-select:none;-webkit-user-modify:read-only;user-modify:read-only;overflow:hidden;text-decoration:none;" class="lp-rich-link" rel="nofollow" href="https://larry.stewart.org/2010/12/05/order-of-operations-evil-and-pernicious/" dir="ltr" role="button" draggable="false" width="300"><table style="table-layout:fixed;border-collapse:collapse;width:300px;background-color:#004567;font-family:-apple-system, Helvetica, Arial, sans-serif;" class="lp-rich-link-emailBaseTable" cellpadding="0" cellspacing="0" border="0" width="300"><tbody><tr><td vertical-align="center"><table bgcolor="#004567" cellpadding="0" cellspacing="0" width="300" style="table-layout:fixed;font-family:-apple-system, Helvetica, Arial, sans-serif;background-color:rgba(0, 69, 103, 1);-apple-color-filter:initial;" class="lp-rich-link-captionBar"><tbody><tr><td style="padding:8px 0px 8px 0px;" class="lp-rich-link-captionBar-textStackItem"><div style="max-width:100%;margin:0px 16px 0px 16px;overflow:hidden;" class="lp-rich-link-captionBar-textStack"><div style="word-wrap:break-word;font-weight:500;font-size:12px;overflow:hidden;text-overflow:ellipsis;text-align:left;" class="lp-rich-link-captionBar-textStack-topCaption-leading"><a rel="nofollow" href="https://larry.stewart.org/2010/12/05/order-of-operations-evil-and-pernicious/" style="text-decoration: none" draggable="false"><font color="#FFFFFF" style="color: rgba(255, 255, 255, 0.847059);">Order of Operations – Evil and Pernicious – A Rubble of Bits</font></a></div><div style="word-wrap:break-word;font-weight:400;font-size:11px;overflow:hidden;text-overflow:ellipsis;text-align:left;" class="lp-rich-link-captionBar-textStack-bottomCaption-leading"><a rel="nofollow" href="https://larry.stewart.org/2010/12/05/order-of-operations-evil-and-pernicious/" style="text-decoration: none" draggable="false"><font color="#FFFFFF" style="color: rgba(255, 255, 255, 0.54902);">larry.stewart.org</font></a></div></div></td><td style="padding:6px 12px 6px 0px;" class="lp-rich-link-captionBar-rightIconItem" width="30"><a rel="nofollow" href="https://larry.stewart.org/2010/12/05/order-of-operations-evil-and-pernicious/" draggable="false"><img style="pointer-events:none !important;display:inline-block;width:30px;height:30px;border-radius:3px;" width="30" height="30" draggable="false" class="lp-rich-link-captionBar-rightIcon" alt="favicon.ico" src="cid:D2F653C2-884E-4542-92D6-5B21FFBD28E0"></a></td></tr></tbody></table></td></tr></tbody></table></a></div></div></div><div><br></div><div><br><blockquote type="cite"><div>On Mar 9, 2025, at 19:12, Larry McVoy <lm@mcvoy.com> wrote:</div><br class="Apple-interchange-newline"><div><div><blockquote type="cite">Anyway, I frankly prefer to see explicit parens, so the precedence<br>is clear ??? it's easier to read and less error-prone for the maintainer.<br></blockquote><br>This, a thousand times, this. I taught my guys "think of coding as write<br>once, read many. I could care less how much more work it is, write code<br>such that it is the easiest to understand".<br></div></div></blockquote></div><br></div></div></body></html>