Click here to Skip to main content
14,361,196 members

C / C++ / MFC

 
QuestionThreading Issues Pin
ForNow5-Jun-15 6:09
memberForNow5-Jun-15 6:09 
AnswerCAsyncSocket notifications Onconnect OnSend owned by main thread Pin
ForNow7-Jun-15 3:15
memberForNow7-Jun-15 3:15 
GeneralRe: Threading Issues Pin
Albert Holguin8-Jun-15 17:21
professionalAlbert Holguin8-Jun-15 17:21 
GeneralRe: Threading Issues Pin
ForNow8-Jun-15 18:21
memberForNow8-Jun-15 18:21 
Questionwhy 4 twice Pin
Member 117446405-Jun-15 5:15
memberMember 117446405-Jun-15 5:15 
AnswerRe: why 4 twice Pin
David Crow5-Jun-15 5:19
memberDavid Crow5-Jun-15 5:19 
AnswerRe: why 4 twice Pin
k50545-Jun-15 6:35
memberk50545-Jun-15 6:35 
AnswerRe: why 4 twice Pin
Frankie-C6-Jun-15 7:56
memberFrankie-C6-Jun-15 7: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 4:15
professionalDaniel Pfeffer7-Jun-15 4:15 
GeneralRe: why 4 twice Pin
Stefan_Lang11-Jun-15 4:14
memberStefan_Lang11-Jun-15 4:14 
GeneralRe: why 4 twice Pin
Daniel Pfeffer11-Jun-15 4:54
professionalDaniel Pfeffer11-Jun-15 4:54 
QuestionNeed help with assembly x86 using C language Pin
a random user4-Jun-15 8:23
membera random user4-Jun-15 8:23 
QuestionRe: Need help with assembly x86 using C language Pin
David Crow4-Jun-15 10:47
memberDavid Crow4-Jun-15 10:47 
AnswerRe: Need help with assembly x86 using C language Pin
a random user5-Jun-15 5:35
membera random user5-Jun-15 5:35 
GeneralRe: Need help with assembly x86 using C language Pin
Richard MacCutchan5-Jun-15 6:09
protectorRichard MacCutchan5-Jun-15 6:09 
JokeRe: Need help with assembly x86 using C language Pin
David Crow5-Jun-15 11:33
memberDavid Crow5-Jun-15 11:33 
GeneralRe: Need help with assembly x86 using C language Pin
a random user6-Jun-15 0:58
membera random user6-Jun-15 0:58 
AnswerRe: Need help with assembly x86 using C language Pin
David A. Gray15-Jun-15 20:23
groupDavid A. Gray15-Jun-15 20:23 
GeneralRe: Need help with assembly x86 using C language Pin
a random user21-Jun-15 10:24
membera random user21-Jun-15 10:24 
QuestionMFC,Run as administrator Pin
Janani932-Jun-15 7:55
memberJanani932-Jun-15 7:55 
AnswerRe: MFC,Run as administrator Pin
Richard Andrew x642-Jun-15 8:45
professionalRichard Andrew x642-Jun-15 8:45 
GeneralRe: MFC,Run as administrator Pin
Janani932-Jun-15 9:01
memberJanani932-Jun-15 9:01 
GeneralRe: MFC,Run as administrator Pin
Richard MacCutchan2-Jun-15 22:29
protectorRichard MacCutchan2-Jun-15 22:29 
GeneralRe: MFC,Run as administrator Pin
Janani934-Jun-15 7:58
memberJanani934-Jun-15 7:58 
GeneralRe: MFC,Run as administrator Pin
Richard MacCutchan4-Jun-15 8:04
protectorRichard MacCutchan4-Jun-15 8: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.