Re:“C is quirky, flawed, and an enormous success” – Dennis R...
by haberman on Sunday July 09, 2023 @10:57AM
(#36654970)
You are entitled to your opinion. C isn't perfect, but as someone who spends my life trying to optimize the efficiency and code size of critical loops to the max, I like the direction C has gone with UB and optimizations. It's not the right tool for every problem, but for the most size/speed critical code it's hard to beat IMO.
I can see the argument, but there's a much better way to communicate to the compiler with your example:
Now a well defined compiler could do what you wanted.I've seen other people suggest that UB is a mechanism to have these magical backdoor conversations to express optimization opportunities. I think that's absurd and reckless. Propose adding assertions or "declare" statements instead, and quit thinking of interpretive dance through a minefield as a method of communication.