I can see why this code is harmless, but it seems so silly I don't know why g++ doesn't warn with -Wall.
Code:#include <ctime> void func(std::time_t) { //do whatever } int main() { func( std::time(0) ); }
I can see why this code is harmless, but it seems so silly I don't know why g++ doesn't warn with -Wall.
Code:#include <ctime> void func(std::time_t) { //do whatever } int main() { func( std::time(0) ); }
"If you tell the truth, you don't have to remember anything"
-Mark Twain
Sometimes, a parameter is intentionally ignored. What surprises me is that when you give the parameter a name, the MinGW port g++ 3.4.5 does not emit a warning concerning an unused variable despite the -Wall option.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
It warns with -Wall and -Wextra, though.
I might be wrong.
Quoted more than 1000 times (I hope).Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
-Wunused-argument is separate from -Wunused-variable because it's more likely to ignore an argument than a local variable. By the same notion, -Wunused-variable is part of -Wall, while -Wunused-argument is in -Wextra.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
I see.
"If you tell the truth, you don't have to remember anything"
-Mark Twain