Click here to Skip to main content
15,887,083 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionThreading Issues Pin
ForNow5-Jun-15 5:09
ForNow5-Jun-15 5:09 
AnswerCAsyncSocket notifications Onconnect OnSend owned by main thread Pin
ForNow7-Jun-15 2:15
ForNow7-Jun-15 2:15 
GeneralRe: Threading Issues Pin
Albert Holguin8-Jun-15 16:21
professionalAlbert Holguin8-Jun-15 16:21 
GeneralRe: Threading Issues Pin
ForNow8-Jun-15 17:21
ForNow8-Jun-15 17:21 
Questionwhy 4 twice Pin
Member 117446405-Jun-15 4:15
Member 117446405-Jun-15 4:15 
AnswerRe: why 4 twice Pin
David Crow5-Jun-15 4:19
David Crow5-Jun-15 4:19 
AnswerRe: why 4 twice Pin
k50545-Jun-15 5:35
mvek50545-Jun-15 5:35 
AnswerRe: why 4 twice Pin
Frankie-C6-Jun-15 6:56
Frankie-C6-Jun-15 6:56 
You got this result because the optimizations are on.
The compiler choose an optimization that leads to the final result not considering what the values could be in the same call. This is consistent with C99, C11 and C++11 standards that to privilege the best optimization of code state that the order of evaluation of the parameters of a function is undefined, and compiler dependent (but also situation dependent different conditions of optimization will lead to different results).
If you test your code with different compilers you'll get different results.
Please consider that even with optimizations off the compiler could give 'strange' values.
BTW the more common output you should expect should be '4 3', because the parameters should normally be evaluated from right to left (incrementing 2 to 3 and pushing it on the stack, then incrementing it to 4 and pushing it on the stack).
When optimization are on basically the compiler decides to make a double increment in one time (instead of move back to the same variable for a second increment).
AnswerRe: why 4 twice Pin
Daniel Pfeffer7-Jun-15 3:15
professionalDaniel Pfeffer7-Jun-15 3:15 
GeneralRe: why 4 twice Pin
Stefan_Lang11-Jun-15 3:14
Stefan_Lang11-Jun-15 3:14 
GeneralRe: why 4 twice Pin
Daniel Pfeffer11-Jun-15 3:54
professionalDaniel Pfeffer11-Jun-15 3:54 
QuestionNeed help with assembly x86 using C language Pin
a random user4-Jun-15 7:23
a random user4-Jun-15 7:23 
QuestionRe: Need help with assembly x86 using C language Pin
David Crow4-Jun-15 9:47
David Crow4-Jun-15 9:47 
AnswerRe: Need help with assembly x86 using C language Pin
a random user5-Jun-15 4:35
a random user5-Jun-15 4:35 
GeneralRe: Need help with assembly x86 using C language Pin
Richard MacCutchan5-Jun-15 5:09
mveRichard MacCutchan5-Jun-15 5:09 
JokeRe: Need help with assembly x86 using C language Pin
David Crow5-Jun-15 10:33
David Crow5-Jun-15 10:33 
GeneralRe: Need help with assembly x86 using C language Pin
a random user5-Jun-15 23:58
a random user5-Jun-15 23:58 
AnswerRe: Need help with assembly x86 using C language Pin
David A. Gray15-Jun-15 19:23
David A. Gray15-Jun-15 19:23 
GeneralRe: Need help with assembly x86 using C language Pin
a random user21-Jun-15 9:24
a random user21-Jun-15 9:24 
QuestionMFC,Run as administrator Pin
Janani932-Jun-15 6:55
Janani932-Jun-15 6:55 
AnswerRe: MFC,Run as administrator Pin
Richard Andrew x642-Jun-15 7:45
professionalRichard Andrew x642-Jun-15 7:45 
GeneralRe: MFC,Run as administrator Pin
Janani932-Jun-15 8:01
Janani932-Jun-15 8:01 
GeneralRe: MFC,Run as administrator Pin
Richard MacCutchan2-Jun-15 21:29
mveRichard MacCutchan2-Jun-15 21:29 
GeneralRe: MFC,Run as administrator Pin
Janani934-Jun-15 6:58
Janani934-Jun-15 6:58 
GeneralRe: MFC,Run as administrator Pin
Richard MacCutchan4-Jun-15 7:04
mveRichard MacCutchan4-Jun-15 7:04 

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.