Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 920 Bytes

rule.adoc

File metadata and controls

30 lines (21 loc) · 920 Bytes

Certain mathematical comparisons will always return the same value, and should simply not be made.

These comparisons will return either always true or always false depending on the kind of comparison:

  • Comparing a char with a numeric constant that is outside of the range of char.

  • Comparing a float with a numeric constant that is outside of the range of float.

  • Comparing a long with a numeric constant that is outside of the range of long.

  • Comparing a ulong with a numeric constant that is outside of the range of ulong.

Noncompliant Code Example

float f = 42.0f;
if (f <= double.MaxValue) { } // Noncompliant

Implementation Specification

(visible only on this page)

(visible only on this page)