Inspectopedia
 
2024.3

Suspicious integer division assignment

Warning
New
Last modified: 03 December 2024

Reports assignments whose right side is a division that shouldn't be truncated to integer.

While occasionally intended, this construction is often buggy.

Example:

This code should be replaced with:

In the inspection options, you can disable warnings for suspicious but possibly correct divisions, for example, when the dividend can't be calculated statically.

New in 2019.2