Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Sometimes, unused parameters can be good design if that's necessary for having a uniform interface across similar functions.
But that should not be logged, rather some "unused" macro or so should be used. -
@Fast-Nop Can you give me an example where it would make sense to keep an unused variable?
I would sure as hell remove it if I saw it in the code. -
@PonySlaystation the main() function when you don't need argv and argc, for example.
Or in general, if you have say 10 tool functions with identical prototype, but the 11th doesn't need one of the variables. I'd keep the variable in the 11th, too, because then you always call all of them in the same way. -
That reminds me of my days in Uni, our C code had to compile with an ludicrous set of warning to error setup and of course unused parameters was one of them, the trick -> (void) param;
-
Parzi88336y@PonySlaystation Global vars in headers throw that warning for every file that imports it if they're not part of a class, even if used in said file that imports it.
-
Parzi88336y@PonySlaystation i've had a few be required in C in low-RAM situations (4MB, Nintendo DS) but if I were working with more RAM (say, 16MB, Nintendo DSi in DSi mode) it'd be perfectly fine to not use them and implement other things, but no...
By the way, fuck the DS. "Oh, computers have like 4GB of RAM or so. Let's give it 4 megs instead so we can squeeze both an ARM7 and ARM9 on it."
Related Rants
Module build failed: Module failed because of a eslint error.
217:15 error 'param' is assigned a value but never used no-unused-vars
Me:
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Don't do it
Me:
console.log(param);
rant
js
eslint
react