Expressions with Unary Operators
Unary operators act on only one operand in an expression. The unary operators are as follows:
These operators have right-to-left associativity. Unary expressions generally involve syntax that precedes a postfix or primary expression.
Syntax
unary-expression
:
postfix-expression
++
cast-expression
--
cast-expression
unary-operator
cast-expression
sizeof
unary-expression
sizeof
(
type-id
)
sizeof
...
(
identifier
)
alignof
(
type-id
)
noexcept-expression
new-expression
delete-expression
unary-operator
: one of
*
&
+
-
!
~
Remarks
Any postfix-expression
is considered a unary-expression
, and because any primary-expression
is considered a postfix-expression
, any primary-expression
is considered a unary-expression
also. For more information, see Postfix expressions and Primary expressions.
The cast-expression
is a unary-expression
with an optional cast to change the type. For more information, see Cast operator: ()
.
The noexcept-expression
is a noexcept-specifier
with a constant-expression
argument. For more information, see noexcept
.
The new-expression
refers to the new
operator. The delete-expression
refers to the delete
operator. For more information, see new
operator and delete
operator.
See also
Feedback
https://aka.ms/ContentUserFeedback.
În curând: Pe parcursul anului 2024, vom elimina treptat Probleme legate de GitHub ca mecanism de feedback pentru conținut și îl vom înlocui cu un nou sistem de feedback. Pentru mai multe informații, consultați:Trimiteți și vizualizați feedback pentru