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.)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With