I've a class like this:
class ScopedLock {
public:
ScopedLock (Locker *lock) { /*...*/ }
~ScopedLock () { /*...*/ }
};
Normally it's called like (this will call the constructor/destructor of ScopedLock at the correct place) :
{
ScopedLock l(&locker);
// ...
}
I've accidentally called it like:
{
ScopedLock(&locker);
// ...
}
What is the name for such a "thing"? Unused anonymous local variable?
Is there a possibility to prevent this? Is there a compiler warning available for such a "thing"?