Click here to Skip to main content
15,886,873 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: what about x = x++; ? Pin
pesho293218-Sep-05 21:48
pesho293218-Sep-05 21:48 
GeneralRe: what about x = x++; ? Pin
bugDanny19-Sep-05 3:02
bugDanny19-Sep-05 3:02 
GeneralRe: what about x = x++; ? Pin
pesho293219-Sep-05 5:38
pesho293219-Sep-05 5:38 
GeneralRe: what about x = x++; ? Pin
bugDanny19-Sep-05 7:43
bugDanny19-Sep-05 7:43 
GeneralRe: what about x = x++; ? Pin
pesho293219-Sep-05 21:14
pesho293219-Sep-05 21:14 
GeneralRe: what about x = x++; ? Pin
bugDanny20-Sep-05 3:16
bugDanny20-Sep-05 3:16 
GeneralRe: what about x = x++; ? Pin
pesho293220-Sep-05 4:52
pesho293220-Sep-05 4:52 
GeneralRe: what about x = x++; ? [Modified 2005-09-19] Pin
Maxwell Chen15-Sep-05 21:17
Maxwell Chen15-Sep-05 21:17 
From the ASM code of VC++2003:

	int x = 1;
00412F6E  mov         dword ptr [x],1 
	int y;
	y = 5 + x++;
00412F75  mov         eax,dword ptr [x] 
00412F78  add         eax,5 
00412F7B  mov         dword ptr [y],eax 
00412F7E  mov         ecx,dword ptr [x] 
00412F81  add         ecx,1 
00412F84  mov         dword ptr [x],ecx 
	printf("y = %d\n", y);
00412F87  mov         eax,dword ptr [y] 
00412F8A  push        eax  
00412F8B  push        offset string "y = %d\n" (4240E4h) 
00412F90  call        @ILT+1320(_printf) (41152Dh) 
00412F95  add         esp,8 
	// y = 6
	x = 1;
00412F98  mov         dword ptr [x],1 
	x = y + x++;
00412F9F  mov         eax,dword ptr [y] 
00412FA2  add         eax,dword ptr [x] 
00412FA5  mov         dword ptr [x],eax 
00412FA8  mov         ecx,dword ptr [x] 
00412FAB  add         ecx,1 
00412FAE  mov         dword ptr [x],ecx 
	printf("x = %d\n", x);
00412FB1  mov         eax,dword ptr [x] 
00412FB4  push        eax  
00412FB5  push        offset string "x = %d\n" (424054h) 
00412FBA  call        @ILT+1320(_printf) (41152Dh) 
00412FBF  add         esp,8 
	// x = 8



// Old.
	int x = 1;
0041262E  mov         dword ptr [x],1 

	x = x;
00412635  mov         eax,dword ptr [x] 
00412638  mov         dword ptr [x],eax 

	x++;
0041263B  mov         eax,dword ptr [x] 
0041263E  add         eax,1 
00412641  mov         dword ptr [x],eax 

	x = x++;
00412644  mov         eax,dword ptr [x] 
00412647  mov         dword ptr [x],eax 
0041264A  mov         ecx,dword ptr [x] 
0041264D  add         ecx,1 
00412650  mov         dword ptr [x],ecx 



Maxwell Chen

-- modified at 22:50 Sunday 18th September, 2005
GeneralRe: what about x = x++; ? Pin
bugDanny16-Sep-05 3:21
bugDanny16-Sep-05 3:21 
QuestionVC++6.0 - Finding users privileges Pin
Rainos15-Sep-05 4:48
Rainos15-Sep-05 4:48 
AnswerRe: VC++6.0 - Finding users privileges Pin
David Crow15-Sep-05 7:32
David Crow15-Sep-05 7:32 
GeneralRe: VC++6.0 - Finding users privileges Pin
Rainos15-Sep-05 21:49
Rainos15-Sep-05 21:49 
GeneralRe: VC++6.0 - Finding users privileges Pin
David Crow16-Sep-05 2:11
David Crow16-Sep-05 2:11 
GeneralRe: VC++6.0 - Finding users privileges Pin
Rainos16-Sep-05 2:49
Rainos16-Sep-05 2:49 
GeneralRe: VC++6.0 - Finding users privileges Pin
David Crow16-Sep-05 4:59
David Crow16-Sep-05 4:59 
GeneralRe: VC++6.0 - Finding users privileges Pin
Rainos16-Sep-05 5:42
Rainos16-Sep-05 5:42 
GeneralRe: VC++6.0 - Finding users privileges Pin
David Crow16-Sep-05 5:48
David Crow16-Sep-05 5:48 
QuestionCTabCtrl Background in XP Themed Pin
RickyC15-Sep-05 4:15
RickyC15-Sep-05 4:15 
AnswerRe: CTabCtrl Background in XP Themed Pin
Ravi Bhavnani15-Sep-05 8:07
professionalRavi Bhavnani15-Sep-05 8:07 
GeneralRe: CTabCtrl Background in XP Themed Pin
RickyC15-Sep-05 9:39
RickyC15-Sep-05 9:39 
GeneralRe: CTabCtrl Background in XP Themed Pin
Ravi Bhavnani15-Sep-05 9:44
professionalRavi Bhavnani15-Sep-05 9:44 
GeneralRe: CTabCtrl Background in XP Themed Pin
RickyC16-Sep-05 1:39
RickyC16-Sep-05 1:39 
GeneralRe: CTabCtrl Background in XP Themed Pin
Ravi Bhavnani16-Sep-05 2:14
professionalRavi Bhavnani16-Sep-05 2:14 
QuestionExtending Command Routing Pin
Joel Holdsworth15-Sep-05 4:03
Joel Holdsworth15-Sep-05 4:03 
AnswerRe: Extending Command Routing Pin
Taka Muraoka15-Sep-05 7:36
Taka Muraoka15-Sep-05 7:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.