operator precedence differs from C language

Frank Ch. Eigler fche@redhat.com
Thu Apr 1 16:30:00 GMT 2010


Neo Liu <diabloneo@gmail.com> writes:

> I found that the operator precedence of "&" and "==" differed from C
> language. Take a look at the following statements.
>     if ($flags & 07 == 0) { ... }

Actually, I think we do it the same way C does.  Comparison operators
such as "==" have higher precedence.

% cat foo.c
int main () {
  printf("%d\n", 0xf0 & 0xff == 0);
}
% cat foo.stp
probe begin {printf("%d\n", 0xf0 & 0xff == 0); exit()}

Both these print 0 for == or !=.


- FChE



More information about the Systemtap mailing list