home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 14 / CD_ASCQ_14_0694.iso / maj / 653 / c_prec.txt < prev    next >
Text File  |  1994-04-03  |  4KB  |  75 lines

  1.           Operator Precedence and Associativity Rules in C / C++
  2.  ============================================================================
  3.     ::        scope resolution (C++, e.g. name::member)     left-to-right
  4.     ::        global (C++, e.g. ::name)
  5.  ----------------------------------------------------------------------------
  6.     ( )       function call                                 left-to-right
  7.     [ ]       array element
  8.      .        class, structure or union member
  9.     ->        pointer reference to member
  10.     ::        scope access / resolution (C++)
  11.   sizeof      size of object in bytes
  12.   sizeof      size of type in bytes
  13.  ----------------------------------------------------------------------------
  14.     ++        post increment (lvalue++)                     right-to-left
  15.     ++        pre increment (++lvalue)
  16.     --        post decrement (lvalue--)
  17.     --        pre decrement (--lvalue)
  18.      ~        bitwise complement
  19.      !        logical not
  20.      -        unary minus
  21.      +        unary plus
  22.      &        address of
  23.      *        contents of
  24.     new       create object (C++)
  25.   delete      destroy object (C++)
  26.   delete[]    destroy array (C++)
  27.   (type)      cast to type
  28.  ----------------------------------------------------------------------------
  29.     .*        member pointer (C++)                          left-to-right
  30.     ->*       pointer reference to member pointer (C++)
  31.  ----------------------------------------------------------------------------
  32.      *        multiply                                      left-to-right
  33.      /        divide
  34.      %        remainder
  35.  ----------------------------------------------------------------------------
  36.      +        add                                           left-to-right
  37.      -        subtract
  38.  ----------------------------------------------------------------------------
  39.     <<        bitwise left shift                            left-to-right
  40.     >>        bitwise right shift
  41.  ----------------------------------------------------------------------------
  42.      <        scalar less than                              left-to-right
  43.     <=        scalar less than or equal to
  44.      >        scalar greater than
  45.     >=        scalar greater than or equal to
  46.  ----------------------------------------------------------------------------
  47.     ==        scalar equal                                  left-to-right
  48.     !=        scalar not equal
  49.  ----------------------------------------------------------------------------
  50.      &        bitwise and                                   left-to-right
  51.  ----------------------------------------------------------------------------
  52.      ^        bitwise exclusive or                          left-to-right
  53.  ----------------------------------------------------------------------------
  54.      |        bitwise or                                    left-to-right
  55.  ----------------------------------------------------------------------------
  56.     &&        logical and                                   left-to-right
  57.  ----------------------------------------------------------------------------
  58.     ||        logical inclusive or                          left-to-right
  59.  ----------------------------------------------------------------------------
  60.    ?  :       conditional expression                        right-to-left
  61.  ----------------------------------------------------------------------------
  62.      =        assignment operator                           right-to-left
  63.               also   +=    -=    *=    /=    %=
  64.                      &=    ^=    |=   >>=   <<=
  65.  ----------------------------------------------------------------------------
  66.      ,        sequential expression                         left-to-right
  67.  ----------------------------------------------------------------------------
  68.  
  69. All of the operators in this table can be overloaded (C++) except:
  70.  
  71.           .     C++ direct component selector
  72.          .*     C++ dereference
  73.          ::     C++ scope access/resolution
  74.          ?:     Conditional
  75.