﻿# V8036\. A meaningless comparison with a variable of an unsigned type\.

The analyzer has detected a meaningless comparison of numeric values that always evaluates to true or false\.

The example:

```cpp
func IncrementNonce(key []byte, keySize uint) {
  ....
  for k := keySize - 3; k >= 0; k-- {
    key[k]++
    if key[k] != 0 {
      break
    }
  }
}
```

In this example, the `k >= 0` comparison is meaningless because the result is always `true`, since the `k` variable is of the `uint` type and cannot take negative values\. Attempting to subtract a loop step from the zero\-value `k` counter will result in the `k` variable taking the maximum value of the `uint` type\. So, the `for` loop will be infinite\.

The fixed code:

```cpp
func IncrementNonce(key []byte, keySize uint) {
  ....
  for k := keySize - 2; k > 0; k-- {
    key[k - 1]++
    if key[k - 1] != 0 {
      break
    }
  }
}
```

In this case, the loop will stop as soon as the `k` variable takes the `0` value\.