You must log in or register to comment.
What the hell kind of magic number is this? Define that stuff in an environment variable, and write a singleton to make the value transparently available where you need it.
Exactly, you never know when you want to change the base for printing out from under someone.
Do you work for Musk?
The compiler should be able to optimize all of them to the same machine code.
- This is already good.
- Easily optimized by constant folding.
This one depends on the semantics of signed underflow, so it may not do what you want.The loop can only exit ifx==10, so as long as thenextInt()method doesn’t have side effects, the loop should be eliminated. But, again, language semantics can affect this.
Edit: Very wrong for 3 & 4, see replies.
I’d be shocked if 4 got optimised out
- It is used to warm up the house.
Genius MIT Hacker
And now this will be in someone’s vibe coded project…



