3 ms·
ok my brain is running on empty right now but I don't really see any explanation about what the problem actually is... I get that something related to some scr
by jgh 11y ago
ok my brain is running on empty right now but I don't really see any explanation about what the problem actually is... I get that something related to some scripting language you're using for your game isn't working, but you never actually explained what is broken.
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.
- aribia 11y agoI 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.
- nhaehnle 11y agoI 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.