> was intended to mean:
>
>   a = ( b & m ) != 0 ;
>
> but was with precedence rules:
>
>   a = b & ( m != 0) ;
>
> which is IMHO really surprising for a reader/programmer...
>
> But it is as it is, and the compiler does what you tell it, and
> not what you *intended* it to do ;-)

This precedence oddity is a well-known C flaw, I believe even K&R have
acknowledged it (something like "what would you change about C if you
could?"  "not much, besides some operator precedence issues").  When I
pass -Wparentheses to gcc, I get:

t.c: In function ‘main’:
t.c:6: warning: suggest parentheses around comparison in operand of &

So there's special warning code to help you with this problem.

The fact that some other languages have imitated this flaw is usually
about "better standard than better", which is usually the reason to
pick a C-like syntax in the first place :)

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to