DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(bc.info.gz) Precedence

Info Catalog (bc.info.gz) Boolean Expressions (bc.info.gz) Expressions (bc.info.gz) Special Expressions
 
 Precedence
 ==========
 
    The expression precedence is as follows: (lowest to highest)
 
      || operator, left associative
      && operator, left associative
      ! operator, nonassociative
      Relational operators, left associative
      Assignment operator, right associative
      + and - operators, left associative
      *, / and % operators, left associative
      ^ operator, right associative
      unary - operator, nonassociative
      ++ and -- operators, nonassociative
 
    This precedence was chosen so that POSIX compliant `bc' programs
 will run correctly. This will cause the use of the relational and
 logical operators to have some unusual behavior when used with
 assignment expressions.  Consider the expression:
 
      a = 3 < 5
 
    Most C programmers would assume this would assign the result of "3 <
 5" (the value 1) to the variable "a".  What this does in `bc' is assign
 the value 3 to the variable "a" and then compare 3 to 5.  It is best to
 use parentheses when using relational and logical operators with the
 assignment operators.
 
Info Catalog (bc.info.gz) Boolean Expressions (bc.info.gz) Expressions (bc.info.gz) Special Expressions
automatically generated byinfo2html