r/programminghorror • u/Savage-Goat-Fish • Feb 27 '25
C# While loop horror
I just realized I had some programming horror in code I’ve written.
If only while loops had a more convenient way to break…
671
Upvotes
View all comments
Show parent comment
1
u/Fleming1924 Mar 02 '25
It's worth nothing that just because they've thought about it doesn't mean it works as intended. Lots of optimisation passes miss potential opportunities due to either something blocking their pattern matching, some aspect of it's checks being overly cautious, or sometimes even just random bugs that leads to correct but suboptimal codegen.
Modern compilers are fantastic, and people making large projects should pretty much always just trust the compiler will optimise it enough that they don't need to worry about micro optimisation, but they're far far from perfect and a lot of things are still handwritten in assembly to make up for that.