[TUHS] What would early alternatives to C have been?
Lawrence Stewart
stewart at serissa.com
Mon Mar 10 09:39:46 AEST 2025
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.
https://larry.stewart.org/2010/12/05/order-of-operations-evil-and-pernicious/
> On Mar 9, 2025, at 19:12, Larry McVoy <lm at 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".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20250309/d9d0a3fe/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: favicon.ico
Type: image/vnd.microsoft.icon
Size: 4119 bytes
Desc: not available
URL: <http://www.tuhs.org/pipermail/tuhs/attachments/20250309/d9d0a3fe/attachment-0001.ico>
More information about the TUHS
mailing list