V596. The object was created but it is not being used. The 'throw' keyword could be missing.

The analyzer has detected a strange use of the std::exception class or derived class. The analyzer generates this warning when an object of the std::exception / CException type is created but not being used. For example:

if (name.empty())
  std::logic_error("Name mustn't be empty");

The error is this: the key word 'throw' is missing by accident. As a result, this code does not generate an exception in case of an error. This is the fixed code:

if (name.empty())
  throw std::logic_error("Name mustn't be empty");

According to Common Weakness Enumeration, potential errors found by using this diagnostic are classified as CWE-390.

You can look at examples of errors detected by the V596 diagnostic.


Bugs Found

Checked Projects
409
Collected Errors
14 072
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site. Learn More →
Accept