Hi
2022. február 28., hétfő 23:28 keltezéssel, James Bottomley írta:
[...] Well, yes, but my objection is more to the size of churn than the desire to do loop local. I'm not even sure loop local is possible, because it's always annoyed me that for (int i = 0; ... in C++ defines i in the outer scope not the loop scope, which is why I never use it.
It is arguably off-topic to the discussion at hand, but I think you might be thinking of something else (or maybe it was the case in an ancient version of C++) because that does not appear to be case. If it were,
for (int i ...) { ... } for (int i ...) { ... }
would have to trigger a redeclaration error, but that happens neither in C++ nor in C. The variable is also inaccessible outside the loop.
[...]
Regards, Barnabás Pőcze