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) );
}
Printable View
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) );
}
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.
It warns with -Wall and -Wextra, though.
-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.
I see.