TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C++ Coding Standard
Search

Rule:  OAL#019Checked automatically with code checker

Synopsis:Don't use the default constructor when creating a local unique_lock
Language:C++
Severity Level:1
Category:Object Allocation


Description:

If you use std::unique_lock, the code compiles if you forget to lock the variable. E.g. both

  std::unique_lock lock(m_mtx);

and

  std::unique_lock m_mtx;

will compile fine but the latter is plain wrong because it won't lock anything in that case.