---
title: "impossible-integer-comparison"
description: "Detect integer comparisons fixed by the type's range."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# impossible-integer-comparison

**Default severity:** `warning`

An integer type's minimum and maximum values make some comparisons always
true or false, such as checking whether an unsigned value is below zero or
above its maximum. Target-sized `int`, `uint`, and `uintptr` use the loaded
build architecture.

## Bad

```go
if value < 0 { use() } // value is unsigned
```

## Good

```go
if value == 0 { use() }
```

Source: https://strider.gempir.com/analyzers/impossible-integer-comparison/index.mdx
