表达式 (C++)Expressions (C++)

本节描述 C++ 表达式。This section describes C++ expressions. 表达式是用于实现以下一个或多个目的而使用的运算符和操作数的序列:Expressions are sequences of operators and operands that are used for one or more of these purposes:

  • 计算来自操作数的值。Computing a value from the operands.

  • 指定对象或函数。Designating objects or functions.

  • 生成“副作用”。Generating "side effects." (副作用是表达式的计算之外的所有操作 - 例如,修改对象的值。)(Side effects are any actions other than the evaluation of the expression — for example, modifying the value of an object.)

在 C++ 中,可以重载运算符,并且其含义可以是用户定义的。In C++, operators can be overloaded and their meanings can be user-defined. 但是,不能修改其优先级以及它们采用的操作数的数目。However, their precedence and the number of operands they take cannot be modified. 本节描述了使用语言提供而不是重载的运算符的语法和语义。This section describes the syntax and semantics of operators as they are supplied with the language, not overloaded. 除了类型的表达式表达式的语义,包括以下主题:In addition to types of expressions and semantics of expressions, the following topics are covered:

其他节中有关运算符的主题:Topics on operators in other sections:

请参阅See also

C++ 语言参考C++ Language Reference