, 우리는 다음과 같은 지침 (https://en.wikipedia.org/wiki/List_of_CIL_instructions를 사용하여 번역) 얻을 :
IL_0000: nop // I compiled in debug mode, this does nothing
IL_0001: ldc.i4.3 // Push 3 onto the stack as int32.
IL_0002: stloc.0 // Pop a value from stack into local variable 0.
IL_0003: ldc.i4.4 // Push 4 onto the stack as int32.
IL_0004: stloc.1 // Pop a value from stack into local variable 1.
IL_0005: ldloc.0 // Load local variable 0 onto stack.
IL_0006: ldloc.1 // Load local variable 1 onto stack.
IL_0007: mul // Multiply values.
IL_0008: ldloc.0 // Load local variable 0 onto stack.
IL_0009: ldc.i4.1 // Push 1 onto the stack as int32.
IL_000a: sub // Subtract value2 from value1, returning a new value.
IL_000b: dup // Duplicate the value on the top of the stack.
IL_000c: stloc.0 // Pop a value from stack into local variable 0.
IL_000d: div // Divide two values to return a quotient or floating-point result.
IL_000e: stloc.2 // Pop a value from stack into local variable 2.
IL_000f: ret // Return from method, possibly with a value.
이 왼쪽에서 오른쪽으로 표현이, 비록 --x
선행을 평가 것을 알 수 *
및 /
.
이
또한 C# 언어 명세 (섹션 7.3 운영자)에 설명되어
식에서 연산자의 평가 순서는 운영자의 우선 순위와 (§7.3.1에 의해 결정된다
).
식의 피연산자는 왼쪽에서 오른쪽으로 계산됩니다. F (i) + G (i ++) * H (i)에서 값을 사용하여 메소드 F를 호출 한 다음 이전 값 i로 메소드 G를 호출하고 마지막으로 메소드 을 호출하여 예제의 경우 H는 i의 새로운 값으로 호출됩니다. 이것은 연산자 우선 순위와 관련이 없으며 연산자 우선 순위와 관련이없는 입니다. '
http://stackoverflow.com/questions/2371118/how-do-the-post-increment-i-and-pre-increment-i-operators-work-in-java – kbunarjo
@kbunarjo 그 아무튼 내 질문에 대답하지 마라. –
x는 - x에 도달하기 전에 이미 평가되었으므로 x는 여전히 3입니다. – kbunarjo