Click here to Skip to main content
15,792,608 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Wrong evaluation of pre- and post-increment on variables: What is wrong here?!?! Pin
SandipG 22-Oct-09 2:57
SandipG 22-Oct-09 2:57 
GeneralRe: Wrong evaluation of pre- and post-increment on variables: What is wrong here?!?! Pin
__yash__22-Oct-09 3:02
professional__yash__22-Oct-09 3:02 
GeneralRe: Wrong evaluation of pre- and post-increment on variables: What is wrong here?!?! Pin
SandipG 22-Oct-09 3:09
SandipG 22-Oct-09 3:09 
GeneralRe: Wrong evaluation of pre- and post-increment on variables: What is wrong here?!?! Pin
Covean22-Oct-09 3:29
Covean22-Oct-09 3:29 
GeneralRe: Wrong evaluation of pre- and post-increment on variables: What is wrong here?!?! Pin
__yash__22-Oct-09 3:40
professional__yash__22-Oct-09 3:40 
GeneralRe: Wrong evaluation of pre- and post-increment on variables: What is wrong here?!?! Pin
SandipG 22-Oct-09 3:44
SandipG 22-Oct-09 3:44 
GeneralRe: Wrong evaluation of pre- and post-increment on variables: What is wrong here?!?! Pin
Covean22-Oct-09 3:48
Covean22-Oct-09 3:48 
GeneralHow do you interpret the results (I have provided my comments) Pin
__yash__22-Oct-09 3:35
professional__yash__22-Oct-09 3:35 
I will surely read the article, i see a lot many interesting points there.

But before that, just a little curious,

1. j++ = 5 //OK. Printed value is 5, after that it becomes 6

2. ++i = 6 //OK. First i is incremented to 6 then printed out

3. ++j = 6 //Incorrect.j will first be incremented then printed out. But note that present value of j is 6 (from step 1). So j at this stage becomes 7.

4. i++ = 6 //OK. i now is 7 after printing

5. j++ = 6 //Incorrect. Should have been 7

6. ++i = 7 //Incorrect. Should have been 8


Just to make things a little simpler
i = j = 5;
printf("%d %d %d\n",i++,i++,i++);
printf("i %d\n",i);


Now the output is:
5 5 5
i 8

Even if the beahviour is compiler-specific how do you interpret this example (or even the first one)?
GeneralRe: How do you interpret the results (I have provided my comments) Pin
SandipG 22-Oct-09 3:45
SandipG 22-Oct-09 3:45 
GeneralRe: How do you interpret the results (I have provided my comments) Pin
Covean22-Oct-09 3:45
Covean22-Oct-09 3:45 
AnswerRe: Wrong evaluation of pre- and post-increment on variables: What is wrong here?!?! Pin
David Crow22-Oct-09 3:55
David Crow22-Oct-09 3:55 
GeneralRe: Wrong evaluation of pre- and post-increment on variables: What is wrong here?!?! Pin
__yash__22-Oct-09 21:52
professional__yash__22-Oct-09 21:52 
QuestionText from the Html Table tag. Pin
NaveenHS22-Oct-09 2:09
NaveenHS22-Oct-09 2:09 
QuestionRe: Text from the Html Table tag. Pin
David Crow22-Oct-09 4:08
David Crow22-Oct-09 4:08 
Questionhow to use lpfnhook to keep view of dialog? Pin
002comp22-Oct-09 0:11
002comp22-Oct-09 0:11 
QuestionRe: how to use lpfnhook to keep view of dialog? Pin
CPallini22-Oct-09 0:40
mveCPallini22-Oct-09 0:40 
AnswerRe: how to use lpfnhook to keep view of dialog? Pin
002comp22-Oct-09 1:04
002comp22-Oct-09 1:04 
GeneralRe: how to use lpfnhook to keep view of dialog? Pin
CPallini22-Oct-09 1:17
mveCPallini22-Oct-09 1:17 
GeneralRe: how to use lpfnhook to keep view of dialog? Pin
002comp22-Oct-09 1:30
002comp22-Oct-09 1:30 
GeneralRe: how to use lpfnhook to keep view of dialog? Pin
CPallini22-Oct-09 1:41
mveCPallini22-Oct-09 1:41 
GeneralRe: how to use lpfnhook to keep view of dialog? Pin
Michael Schubert22-Oct-09 1:54
Michael Schubert22-Oct-09 1:54 
GeneralRe: how to use lpfnhook to keep view of dialog? Pin
Richard MacCutchan22-Oct-09 2:40
mveRichard MacCutchan22-Oct-09 2:40 
GeneralRe: how to use lpfnhook to keep view of dialog? Pin
David Crow22-Oct-09 4:10
David Crow22-Oct-09 4:10 
Questionexpression evaluation problem Pin
fcis200822-Oct-09 0:05
fcis200822-Oct-09 0:05 
AnswerRe: expression evaluation problem Pin
Rajesh R Subramanian22-Oct-09 0:15
professionalRajesh R Subramanian22-Oct-09 0:15 

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.