Skip to content

address-nil-comparison

Default severity: warning

Taking the address of an addressable value produces a non-nil pointer whenever evaluation completes, so comparing that address with nil has a fixed result.

The &*pointer form is excluded because it simplifies to pointer, which may legitimately be nil.

if &value == nil { handle() }
if pointer == nil { handle() }