Skip to content

Instantly share code, notes, and snippets.

@hfm
Last active December 26, 2015 20:28
Show Gist options
  • Select an option

  • Save hfm/7208484 to your computer and use it in GitHub Desktop.

Select an option

Save hfm/7208484 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main() {
unsigned int i = 0;
for (--i; i >= 0; --i) {
printf("%u\n", i);
}
}

clangでコンパイルすると次のようなWARNING。

mugen.c:6:15: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]
  for (--i; i >= 0; --i) {
            ~ ^  ~
1 warning generated.

gccだと-Wみたいなオプションつけると似たような警告。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment