On Tuesday, 11 September 2018 1:25:55 AM AEST Peter St. John wrote:

> I had wanted to say that such a bug would be caught by compiling with some
> reasonalbe warning level; but I think I was wrong.

Interesting - looks like it depends on your GCC version, 7.3.0 catches it with 
-Wall here:

chris@quad:/tmp$ gcc -Wall test.c -o test
test.c: In function ‘main’:
test.c:6:2: warning: this ‘if’ clause does not guard... 
[-Wmisleading-indentation]
  if ( test );
  ^~
test.c:7:3: note: ...this statement, but the latter is misleadingly indented as 
if it were guarded by the ‘if’
   printf ( "hello\n" );
   ^~~~~~

> So I guess I have to forgive the software engineer who fat-fingered that
> semicolon. Of course I've done worse.

Oh yes, same here too!   There but for... and all that. :-)

All the best,
Chris
-- 
 Chris Samuel  :  http://www.csamuel.org/  :  Melbourne, VIC



_______________________________________________
Beowulf mailing list, Beowulf@beowulf.org sponsored by Penguin Computing
To change your subscription (digest mode or unsubscribe) visit 
http://www.beowulf.org/mailman/listinfo/beowulf

Reply via email to