increment



I defined an integer in Visual C++ as follows:

int c=0;

Then, I did the following:

c++;

Miscrosoft Visual C++ says "c++;" compiled into the following code:

mov eax,dword ptr [c]
add eax,1
mov dword ptr [c],eax

I'm trying to figure out why it didn't just compile into this:

add dword ptr [ebp-4], 1

Is this just compiler inefficiency, or is there some reason the VC++
code is actually faster?

Thanks.

.