News for hackers. Stuff that matters.
Re:Why Timothy Cain creator of Fallout left Fallout 2 during... by rgbgraph on Saturday May 27, 2023 @09:19PM (#36100178)
This form is basically always used for enumeration.

Might as well just do (x != y); unless you're specifically looking to guard against erroneous bitflips that would be caught by the prior (x < y), but not the former. But at that point -- it's likely your result is going to be garbage.

In essence they're the same; but one you never have to think about whether you're using it correctly.

Can anyone find a reason not to swap out (x < y) for (x != y)?

Re:Why Timothy Cain creator of Fallout left Fallout 2 during... by olkingcole on Saturday May 27, 2023 @09:39PM (#36100293)
(If I'm understanding correctly) one example is if have two places where you x++ in the loop, so if you make an error in there you might end up hitting both of them and incrementing from y-1 to y+1.
Re:Why Timothy Cain creator of Fallout left Fallout 2 during... by rowanG077 on Saturday May 27, 2023 @09:30PM (#36100247)
`<` communicates the intent way better. It also more readable

Example: The loop should run as long as the counter is smaller then 10. `i /= 10` achieves the same thing but communicates something very different. It implies `i` may be changed inside the loop to become larger then 10. The condition itself implies a larger valid state space.

Anyway it's a moot point anyway. Modern languages have much better looping constructs.

Re:Why Timothy Cain creator of Fallout left Fallout 2 during... by rincebrain on Sunday May 28, 2023 @10:35AM (#36104333)
If you have a bug and produce x+=2, you never terminate?

One might argue corrupting much larger swathes of memory is better from a "fail-fast" perspective, but there's always tradeoffs.