简体   繁体   English

什么是评价?

[英]What is evaluation?

I have been stumbling upon this term for a quite a while (man, math, programming, makefile, etc.) Am I understanding the term correctly? 我已经在这个词上绊了很长时间了(人,数学,编程,makefile等)。我是否正确理解这个词? Evaluation is a calculation of the result of some expression, ex.: 评估是对某些表达式的结果的计算,例如:

a + b - expression a + b-表达式

To evaluate it (get some result by number) we give variables value like so 为了评估它(通过数字得到一些结果),我们给变量值像这样

a = 1, b = 1 a = 1,b = 1

Judging from that we get a result "2" ( which means we evaluated the expression to "2" with input values 由此判断,我们得到的结果为“ 2”(这意味着我们使用输入值将表达式评估为“ 2”

a = 1, b = 1) a = 1,b = 1)

C 2018 5.1.2.3 2 says “ Evaluation of an expression in general includes both value computations and initiation of side effects.” So, yes, in large part evaluation is computing the value from some expression. C 2018 5.1.2.3 2说:“对表达式的评估通常包括值计算和副作用的开始。”因此,是的,在很大程度上,评估是从某个表达式计算值。 In C, evaluation also includes side effects, such as the increment caused by x++ , which affects x but does not contribute to the value of the expression it is in. 在C语言中,求值还包括副作用,例如x++引起的增量,它会影响x但不会影响其所在表达式的值。

5.1.2.3 2 goes on to say “Value computation for an lvalue expression includes determining the identity of the designated object.” That is more about the semantics by which the C language is described than about performing a computation, so I will not discuss it further here. 5.1.2.3 2继续说“对左值表达式的值计算包括确定指定对象的身份。”这更多是关于描述C语言的语义,而不是有关执行计算,因此,我将不讨论它。在这里。

6.5 1 tells us “An expression is a sequence of operators and operands that specifies computation of a value, or that designates an object or a function, or that generates side effects, or that performs a combination thereof.” So, for the value aspect of an expression, the expression specifies a computation, and evaluation performs that computation. 6.5 1告诉我们“表达式是一个运算符和操作数的序列,它们指定值的计算,或者指定对象或函数,或者产生副作用,或者执行它们的组合。”因此,对于值方面对于表达式的表达式,表达式指定一个计算,然后求值执行该计算。 The expression may also specify side effects, and evaluation performs those too. 该表达式还可以指定副作用,而评估也可以执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM