Re:Unused Arguments Aren't a Problem When Recursing Right?
by aribia on Saturday November 07, 2015 @02:25AM
(#10524060)
I think the problem the author is trying to bring up is that if the only place the variable is used is in a recursive call, this should be the same warning as if its not used at all. There's no way it can impact the return value (or side effects) of the function.
Re:Unused Arguments Aren't a Problem When Recursing Right?
by nhaehnle on Saturday November 07, 2015 @03:34AM
(#10524176)
I found this a bit confusing as well at first, but it's really simple enough: The point of the article isn't the scripting language itself. It's that the author encountered a bug in the scripting language implementation that would have been found much earlier if the compiler had warned about the argument that is de facto unused.
This is a general point: More warnings can help find more bugs earlier - but you do have to worry about false positives, and warnings that increase compile time can also be a net negative.
The author's example is probably simple and efficient enough to add to a compiler, assuming that it performs some basic recursion analysis already.
Are unused arguments a problem when recursing? I can imagine they are if they're taking up stack space and you're doing an awful lot of recursing (I don't really use recursion enough in my C++ code to really run into issues like this, so I am a little ignorant on the side effects of recursing deeply).
Anyway it's time for bed and I'm sure this article is going to be giving me nightmares tonight.