该语法还知道运算符优先级。
为什么语言运算符优先级吗?
创建前面示例中这样的复杂表达式要求彻底理解运算符优先级的规则。
Creating complex expressions such as the one in the preceding example requires a thorough understanding of the rules of operator precedence.
不幸的是,多数代码格式化工具都会漠视运算符优先级,从头到尾采用同样的空格方式。
Unfortunately, most tools for reformatting code are blind to the precedence of operators and impose the same spacing throughout.
使用目前常用的算符优先法,对通用表达式计算过程进行了介绍,并对其中的关键问题——运算符优先矩阵的设计和实现进行了研究。
Using the current commonly used operator priority method, introduces a common expression of the calculation process, and one of the key issues, operator precedence matrix design and implementation.
逻辑运算符的优先级低于单独的比较运算符,这一点意义重大,因为必须先计算比较运算符,然后才能计算逻辑运算符。
The logical operators have lower precedence than the individual comparison operators, which makes sense because the comparison has to be evaluated before the logical operator can be evaluated.
另外,成员可以有自己的合并运算符(如果设置了的话),并且优先级别高于数据集合并运算符。
Furthermore, the members can have their own merge operators defined which, if they are set, will have priority over the cube merge operator.
乘法和除法运算符(表3中列出的前四个)具有高于加法和减法的优先级。
The multiplication and division operators (the first four listed in Table 3) have higher precedence than the addition and subtraction operators.
逻辑运算符的实际优先级就是表2中罗列这些运算符的顺序。
The actual precedence of the logical operators is given by the order these operators are presented in Table 2.
可用的运算符(按照优先权分组)在表3中做了总结。
The available operators (grouped by increasing precedence) are summarized in Table 3.
如果松绑定(looser - binding)运算符使用紧绑定(tighter - binding)运算符作为操作数表达式,那么优先级是自动处理的。
If looser-binding operators take as operands expressions using tighter-binding operators, precedence is handled automatically.
表达式可能会包含不止一个运算符,这些不同的运算先后次序就是运算符的优先级。
When an expression contains more than one operator, the order of evaluation depends on the order of operations.
结合性规定了具有相同优先级的运算符如何进行分组。
Associativity specifies how to group operators at the same precedence level.
有一些运算符的优先级不合适;语法的一些部分还可以做得更好。
Some of the operators have the wrong precedence; some parts of the syntax could be better.
本章末尾的表2-1完整总结了所有运算符的优先级和结合律。
Table 2.1 at the end of this chapter summarizes precedence and associativity for all operators.
幂运算符比在操作数左边的一元运算符有更高的优先级;但比右面的一元运算符要低。句法为。
The power operator binds more tightly than unary operators on its left; it binds less tightly than unary operators on its right. The syntax is.
也就是说程序能判定各个运算符的优先权,然后进行分析计算。
That program can determine the priority of each operator, and then calculated and analyzed.
条件运算符的优先级比按位运算符的优先级低。
The conditional operator has lower precedence than bitwise operators.
条件运算符的优先级比按位运算符的优先级低。
The conditional operator has lower precedence than bitwise operators.
应用推荐