frieder wrote:
 > Hi Arkadi
 > 
 > Arkadi Shishlov schrieb:
 > > Is it possible to get a warning from the compiler for suspicious lines of 
 > code like
 > > some_var == 123;
 > > that makes little sense.
 > > ?
 > 
 > Indeed!)
 > 
 > This one probably makes even less sense but also
 > passes without error (both GCC and SDCC:)

GCC gives plenty of warnings with -Wall:
$ gcc -Wall f.c
f.c: In function 'main':
f.c:5: warning: the address of 'foo' will always evaluate as 'true'
f.c:7: warning: the address of 'foo' will always evaluate as 'true'
f.c:8: warning: left-hand operand of comma expression has no effect
f.c:8: warning: left-hand operand of comma expression has no effect
f.c:8: warning: statement with no effect
f.c:8: warning: statement with no effect
f.c:10: warning: statement with no effect
f.c:12: warning: statement with no effect
f.c:14: warning: statement with no effect
f.c:17: warning: statement with no effect
f.c:20: warning: statement with no effect
f.c:23: warning: statement with no effect
f.c:23: warning: statement with no effect
f.c:25: warning: statement with no effect


 > 
 > 
 > ------8<------------------------------------------
 > void foo(){} int main( void )
 > {
 >      int i = foo?
 >      100:10;
 > 
 >      while( foo && i-- )
 >          1,2,3; 4;
 > 
 >      5;
 > 
 >      5 == 6;
 > 
 >      7 / 8 == 78;
 > 
 >      7/8 ? (79):
 >      90;
 > 
 >      "GCC 4.3.1 and SDCC 2.8.2 eat this"
 >      "without error" ;;; "to"
 >      "be more accurate: also without warning"
 > 
 >      "Don't we all like C" ? "No" : "No"; !"YES";
 > 
 >      return ~!!i?i==8:8%+8;-7;;
 > }
 > ------>8------------------------------------------
 > 
 > -------------------------------------------------------------------------
 > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
 > Build the coolest Linux based applications with Moblin SDK & win great prizes
 > Grand prize is a trip for two to an Open Source event anywhere in the world
 > http://moblin-contest.org/redirect.php?banner_id=100&url=/
 > _______________________________________________
 > Sdcc-user mailing list
 > [email protected]
 > https://lists.sourceforge.net/lists/listinfo/sdcc-user

=---------------------
 paul fox, [EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to