9 ms·
Ah, yeah. There shouldn't be any runtime difference if you don't leak the address of `i` somewhere the compiler can't see, which should be uncommon for an iter
by dllthomas 7y ago
Ah, yeah. There shouldn't be any runtime difference if you don't leak the address of `i` somewhere the compiler can't see, which should be uncommon for an iterator. But I agree it's awkward.
You can wrap the whole thing in an extra block, so at least you don't have to hoist `i` to the top of the function.
> (Declaring variables willy nilly anywhere in a block is nice too)
You can always introduce another block, although it's not uncommon that that's harder on legibility than just hoisting.