Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> There's no rationale given

True and it would indeed be desirable that it were. Here I go out on a limb and assume it's because someone got bitten by attempting to use the loop index outside the loop (common for search operations) while declaring the index within and outside the loop. A bug (gcc and clang can warn about using -Wshadow, but which sadly isn't part of -Wall) which might easily occur when multiple people edit the code over a longer time-span.



I use Wshadow personally. I highly recommend it. I think code that violates it (even if correct) is harder to understand.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: