This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: operator precedence differs from C language


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]