Reputation: 1056
In this code snippet...
sf::Time obj;
sf::Time* ptr;
int i;
int* p2;
The first line doesn't produce a warning, but the other three do. How come?
(Btw, this is an entire method. Nothing is done with the variables.)
Upvotes: 3
Views: 101
Reputation: 58745
Objects can have constructors and destructors. So, while you may not be using the actual variable, you may be relying on code that runs in the constructor or destructor.
A good example of this is std::lock_guard
, which takes advantage of a destructor to unlock a mutex when the lock goes out of scope.
Upvotes: 6