Show: Delphi C++
Display Preferences

DivideZero - Check for Division by Zero

From RAD Studio
Jump to: navigation, search

Go Up to C++ Audits

Description

DivideZero detects situations where an integer value is divided by zero. This will result in an integer divide-by-zero exception being thrown at run time.

Incorrect

 void eval(int value, int scale) {
   if (scale != 0) {
     ...
   } else {
      int scaledValue = value / scale;
      ...
   }
 }

See Also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance