github / github/codeql

LGTM.com - false positive: constant-comparison with assignment on one side

Aberta
#3,496 0 comentários 0 reações 0 responsáveis Ver no GitHub
C++ false-positive
Linguagem predominante
CodeQL
Estrelas
10.1k
Forks
2.1k
Merge médio
2d 15h
PRs com merge (30d)
141

Descrição

I have

int next_char;
...
(next_char = gzgetc(file_)) != -1

where gzgetc is from zlib:

ZEXTERN int ZEXPORT gzgetc OF((gzFile file));

It triggers constant-comparison rule with message:

> Comparison is always true because ... = ... >= 0.

In this case (a = b) is integer assignment and can be negative.

https://lgtm.com/projects/g/project-gemmi/gemmi/snapshot/d1a210cf4810719b905806a690feade01e6eb5c9/files/include/gemmi/gz.hpp?sort=name&dir=ASC&mode=heatmap#x4ec8a4d86c53b859:1

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.