6.5.3.3 Unary arithmetic operators

Previous Table of Contents

1091 The operand of the unary + or - operator shall have arithmetic type;

1092 of the ~ operator, integer type;

1093 of the ! operator, scalar type.

1094 The result of the unary + operator is the value of its (promoted) operand.

1095 The integer promotions are performed on the operand, and the result has the promoted type.

1096 The result of the unary - operator is the negative of its (promoted) operand.

1097 The integer promotions are performed on the operand, and the result has the promoted type.

1098 The result of the ~ operator is the bitwise complement of its (promoted) operand (that is, each bit in the result is set if and only if the corresponding bit in the converted operand is not set).

1099 The integer promotions are performed on the operand, and the result has the promoted type.

1100 If the promoted type is an unsigned type, the expression ~E is equivalent to the maximum value representable in that type minus E.

1101 The result of the logical negation operator ! is 0 if the value of its operand compares unequal to 0, 1 if the value of its operand compares equal to 0.

1102 The result has type int.

1103 The expression !E is equivalent to (0==E).

1104 84) Thus, &*E is equivalent to E (even if E is a null pointer), and &(E1[E2]) to ((E1)+(E2)).

1105 It is always true that if E is a function designator or an lvalue that is a valid operand of the unary & operator, *&E is a function designator or an lvalue equal to E.

1106 If *P is an lvalue and T is the name of an object pointer type, *(T)P is an lvalue that has a type compatible with that to which T points.

1107 Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer, an address inappropriately aligned for the type of object pointed to, and the address of an object after the end of its lifetime.

Next

Created at: 2005-06-29 02:18:59 The text from WG14/N1124 is copyright © ISO