Elektrine lite

← Feed

@hjvt@hachyderm.io

Post #2176857

2026-05-07 07:37 UTC

@chrysn@chaos.social @nyx@lgbtqia.space @shana@mastodon.gamedev.place damn, that's an interesting thought. IIRC, it would actually be permissible for a C++ compiler to do this, since infinite loops without side-effects are UB by spec.

Replies (1)

  • @chrysn@chaos.social 2026-05-07 08:11

    @hjvt@hachyderm.io @nyx@lgbtqia.space @shana@mastodon.gamedev.place That's the UB I was thinking of. For the compiler to make that jump, I think the loop still needs a break condition, like "if next == last", otherwise, the compiler would just mark the whole branch as unreachable. With ffastmath or equivalent, a compiler could trust that the sequence converges, and apply analytics such that 1.0+2.0+3.0+... = -1/12 or 1.0+0.9+0.81+... = 10.0, even when due to rounding it might not actually converge.

    Open ##2176858