Click here to Skip to main content
15,923,789 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: ++i and i++ Pin
John M. Drescher27-Dec-05 18:52
John M. Drescher27-Dec-05 18:52 
GeneralRe: ++i and i++ Pin
Nishad S27-Dec-05 20:09
Nishad S27-Dec-05 20:09 
AnswerRe: ++i and i++ Pin
Owner drawn27-Dec-05 18:52
Owner drawn27-Dec-05 18:52 
AnswerRe: ++i and i++ Pin
vikas amin27-Dec-05 19:18
vikas amin27-Dec-05 19:18 
GeneralRe: ++i and i++ Pin
Nishad S27-Dec-05 20:10
Nishad S27-Dec-05 20:10 
GeneralRe: ++i and i++ Pin
segment_fault3-Jan-06 17:54
segment_fault3-Jan-06 17:54 
GeneralRe: ++i and i++ Pin
Nishad S27-Dec-05 20:11
Nishad S27-Dec-05 20:11 
AnswerRe: ++i and i++ Pin
Prakash Nadar27-Dec-05 21:42
Prakash Nadar27-Dec-05 21:42 
from the VC assembly dump.

10:       for(i=0;i<5; i++)
00401028   mov         dword ptr [ebp-4],0
0040102F   jmp         main+2Ah (0040103a)
00401031   mov         eax,dword ptr [ebp-4]
00401034   add         eax,1
00401037   mov         dword ptr [ebp-4],eax
0040103A   cmp         dword ptr [ebp-4],5
0040103E   jge         main+3Fh (0040104f)
11:           printf("Hello World!\n");
00401040   push        offset string "Hello World!\n" (0042001c)
00401045   call        printf (004010b0)
0040104A   add         esp,4
0040104D   jmp         main+21h (00401031)
12:
13:       for(i=0;i<5; ++i)
0040104F   mov         dword ptr [ebp-4],0
00401056   jmp         main+51h (00401061)
00401058   mov         ecx,dword ptr [ebp-4]
0040105B   add         ecx,1
0040105E   mov         dword ptr [ebp-4],ecx
00401061   cmp         dword ptr [ebp-4],5
00401065   jge         main+66h (00401076)
14:           printf("Hello World!\n");
00401067   push        offset string "Hello World!\n" (0042001c)
0040106C   call        printf (004010b0)
00401071   add         esp,4
00401074   jmp         main+48h (00401058)


so clearly the code for both cases is the same.
so no difference if you use the incrementor statements (pre or post) that are independent.


<hr<span style="color:gray;size:15px;">-Prakash
-Prakash
GeneralRe: ++i and i++ Pin
Nishad S27-Dec-05 21:52
Nishad S27-Dec-05 21:52 
GeneralRe: ++i and i++ Pin
vikas amin27-Dec-05 22:01
vikas amin27-Dec-05 22:01 
AnswerRe: ++i and i++ Pin
vikas amin28-Dec-05 0:29
vikas amin28-Dec-05 0:29 
QuestionModelless dialog box Pin
pooja_12327-Dec-05 17:36
pooja_12327-Dec-05 17:36 
AnswerRe: Modelless dialog box Pin
Owner drawn27-Dec-05 17:41
Owner drawn27-Dec-05 17:41 
AnswerRe: Modelless dialog box Pin
Prakash Nadar27-Dec-05 21:56
Prakash Nadar27-Dec-05 21:56 
QuestionHow can I know if there is a Floppy disk in the Floppy drive? Pin
Owner drawn27-Dec-05 17:24
Owner drawn27-Dec-05 17:24 
AnswerRe: How can I know if there is a Floppy disk in the Floppy drive? Pin
Abhi Lahare27-Dec-05 19:12
Abhi Lahare27-Dec-05 19:12 
GeneralRe: How can I know if there is a Floppy disk in the Floppy drive? Pin
Owner drawn27-Dec-05 19:20
Owner drawn27-Dec-05 19:20 
GeneralRe: How can I know if there is a Floppy disk in the Floppy drive? Pin
Owner drawn27-Dec-05 19:57
Owner drawn27-Dec-05 19:57 
AnswerRe: How can I know if there is a Floppy disk in the Floppy drive? Pin
Blake Miller3-Jan-06 5:16
Blake Miller3-Jan-06 5:16 
Question__try/__except vs try/catch Pin
Chintoo72327-Dec-05 17:07
Chintoo72327-Dec-05 17:07 
AnswerRe: __try/__except vs try/catch Pin
S. Senthil Kumar27-Dec-05 18:51
S. Senthil Kumar27-Dec-05 18:51 
AnswerRe: __try/__except vs try/catch Pin
vikas amin27-Dec-05 19:00
vikas amin27-Dec-05 19:00 
Questionindexed palette in opengl Pin
P1P3R27-Dec-05 11:00
P1P3R27-Dec-05 11:00 
QuestionVisual Studio Bug ???? Pin
Shay Harel27-Dec-05 10:41
Shay Harel27-Dec-05 10:41 
AnswerRe: Visual Studio Bug ???? Pin
Dr Dan27-Dec-05 11:13
Dr Dan27-Dec-05 11:13 

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.