Re:What is your favourite C programming trick?
by mikeash on Friday October 14, 2011 @11:32AM
(#3111550)
Would be nice if there was one which would warn for this specific case but not shadowing in general, which I occasionally like. (This probably makes me a bad person.)
[ Parent
| on HN ]
Re:What is your favourite C programming trick?
by ajross on Friday October 14, 2011 @12:11PM
(#3111723)
It certainly doesn't make you a bad person. If lexical scoping wasn't the intent of the language authors, it wouldn't exist. I tend to agree that the warning is more of a hassle than it's worth. Though I guess it can be argued that if your scoping is so deep that you actually need to reuse names, that perhaps some refactoring should be in order.
Re:What is your favourite C programming trick?
by kstenerud on Friday October 14, 2011 @12:10PM
(#3111714)
Seeing a variable shadow something in an outer scope makes me cringe, simply because the decrease in readability far outweighs any benefit it could give. You might remember how things are, but the poor sap who has to keep extra scoping depths in his mind just to maintain your code will curse your name every day.