Skip to content

Commit

Permalink
Add more lines of intentionally warning code
Browse files Browse the repository at this point in the history
Some compilers do not warning about signed/unsigned mismatch by
default. We want to trigger warnings by default when this file
is compiled.
  • Loading branch information
dlrdave committed Sep 13, 2011
1 parent a0acdce commit 68c3ceb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions intentional_compile_warning.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

int main(int argc, const char* argv[])
{
unsigned char c = 65537; // a constant clearly outside the range of a 'char'
unsigned int i = 0; // "i<argc" should produce a "signed/unsigned comparison" warning
unsigned int j = 0; // j is never used after its assignment
unsigned int k; // k is neither initialized nor used...
for (; i<argc; ++i)
{
fprintf(stdout, "%s\n", argv[i]);
Expand Down

0 comments on commit 68c3ceb

Please sign in to comment.