Oh, I see. Didn't think of that. I didn't want to use only a++ and ++a in case the return value would be omitted. Anyway, I redid the test like this (I see now what that double mov-statement was ^^). The result is the same. Both ways have the same instructions set, only in a different order.
Code:
void Inc_1()
{
int a = 0;
int b = a++; //Line 4
}
void Inc_2()
{
int a = 0;
int b = ++a; //Line 10
}
int main()
{
Inc_1();
Inc_2();
return 0;
}
Code:
; Line 4
mov eax, DWORD PTR _a$[ebp]
mov DWORD PTR _b$[ebp], eax
mov ecx, DWORD PTR _a$[ebp]
add ecx, 1
mov DWORD PTR _a$[ebp], ecx
Code:
; Line 10
mov eax, DWORD PTR _a$[ebp]
add eax, 1
mov DWORD PTR _a$[ebp], eax
mov ecx, DWORD PTR _a$[ebp]
mov DWORD PTR _b$[ebp], ecx