take int type as example C+ + compiler for + +I generated the code is 013E1375 mov eax,dword ptr [i] 013E1378 add eax,1013e137b mov dword ptr [I],eax is very simple, basically do not parse the first line is to put the value of I into EAX, and then call add to EAX+1, and finally put the eax in I and then look at I++0119137E mov eax,dword ptr [i]01191381add eax,1 01191384mov dword ptr [i],eax result is exactly the same as below and look at the case with assignmentintc = + +i;012d1384 mov eax,dword ptr [i] 012d1387 add eax,1012d138a mov dword ptr [i],eax 012d138d mov ecx,dword ptr [i] 012d1390 mov dword ptr [C],ECX Can see this operation after the completion of the first three to do two mov put the final I value in C and then seeintb = i++; 012d1375 mov eax,dword ptr [i] 012d1378 mov dword ptr [b],eax 012d137b mov ecx,dword ptr [i] 012d137e add ecx,1012d1381 mov dword ptr [I],ECX results slightly different, after putting the value of I mov to EAX and immediately put EAX into B, then the three steps remain consistent with the previous only register replaced by ECX, just in accordance with IFeatures of + +
Future CTO pays attention to my CTO's road from now on: wlaicto
C + + | Debug ·? See the difference between i++ and ++i from assembly code