Click here to Skip to main content
16,008,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionLoading 3D images.. Pin
Noor Akhter21-Jul-06 21:07
Noor Akhter21-Jul-06 21:07 
AnswerRe: Loading 3D images.. Pin
JWood22-Jul-06 1:02
JWood22-Jul-06 1:02 
QuestionProblem with cout... Pin
Talent Chan21-Jul-06 20:52
Talent Chan21-Jul-06 20:52 
AnswerRe: Problem with cout... [modified] Pin
A_Fa21-Jul-06 21:36
A_Fa21-Jul-06 21:36 
GeneralRe: Problem with cout... Pin
Talent Chan21-Jul-06 22:55
Talent Chan21-Jul-06 22:55 
GeneralRe: Problem with cout... Pin
A_Fa22-Jul-06 0:15
A_Fa22-Jul-06 0:15 
GeneralRe: Problem with cout... Pin
debugger_200822-Jul-06 0:45
debugger_200822-Jul-06 0:45 
AnswerRe: Problem with cout... Pin
Stephen Hewitt22-Jul-06 1:09
Stephen Hewitt22-Jul-06 1:09 
First note that the problem has nothing to do with "cout":
----------------------------------------------------------
//#include <iostream>
//using namespace std;

#include <stdio.h>

class A
{
private:
unsigned int m_nCount;

public:
A()
{
m_nCount = 0;
}

~A(){}

int Test(char ch)
{
// cout << ch << endl;
printf("%c\n", ch);
m_nCount++;
return m_nCount;
}

};

void main()
{
A a;
printf("%d%d%d\n", a.Test('a'), a.Test('b'), a.Test('c'));
// cout << a.Test('a') << a.Test('b') << a.Test('c') << endl;
}
----------------------------------------------------------
Output is:
c
b
a
321

The same output is produced if "cout" is used. Note the "a", "b" and "c"s - this shows what's happening: The expressions are being evaluated from right to left.

There is nothing going wrong, see here:
http://www.kuzbass.ru/docs/isocpp/expr.html
Here's a quote:
"-4- Except where noted, the order of evaluation of operands of individual operators and subexpressions of individual expressions, and the order in which side effects take place, is unspecified."


Steve
AnswerRe: Problem with cout... Pin
Talent Chan22-Jul-06 1:53
Talent Chan22-Jul-06 1:53 
AnswerRe: Problem with cout... Pin
Michael Dunn22-Jul-06 9:40
sitebuilderMichael Dunn22-Jul-06 9:40 
QuestionProblem about the "Optimization: Maximize Speed(O2)" Pin
chenxiujie21-Jul-06 18:10
chenxiujie21-Jul-06 18:10 
QuestionHow can I build a library for Mac (or Linux) on Windows Pin
plowstar21-Jul-06 16:49
plowstar21-Jul-06 16:49 
QuestionHow to forbid the user to terminate my program. Pin
Member 200639821-Jul-06 16:30
Member 200639821-Jul-06 16:30 
QuestionRe: How to forbid the user to terminate my program. Pin
Steve Echols21-Jul-06 17:03
Steve Echols21-Jul-06 17:03 
AnswerRe: How to forbid the user to terminate my program. Pin
Joe Woodbury21-Jul-06 17:37
professionalJoe Woodbury21-Jul-06 17:37 
GeneralRe: How to forbid the user to terminate my program. Pin
flippydeflippydebop21-Jul-06 19:25
flippydeflippydebop21-Jul-06 19:25 
GeneralRe: How to forbid the user to terminate my program. Pin
wanglei198021-Jul-06 19:35
wanglei198021-Jul-06 19:35 
AnswerRe: How to forbid the user to terminate my program. Pin
Stephen Hewitt21-Jul-06 19:38
Stephen Hewitt21-Jul-06 19:38 
GeneralRe: How to forbid the user to terminate my program. Pin
Hamid_RT21-Jul-06 23:37
Hamid_RT21-Jul-06 23:37 
AnswerRe: How to forbid the user to terminate my program. Pin
Maxwell Chen22-Jul-06 7:41
Maxwell Chen22-Jul-06 7:41 
QuestionTextbox selection color Pin
Fernando A. Gomez F.21-Jul-06 14:08
Fernando A. Gomez F.21-Jul-06 14:08 
AnswerRe: Textbox selection color Pin
Richard Andrew x6421-Jul-06 18:44
professionalRichard Andrew x6421-Jul-06 18:44 
AnswerRe: Textbox selection color Pin
James Brown21-Jul-06 21:45
James Brown21-Jul-06 21:45 
AnswerRe: Textbox selection color Pin
Hamid_RT21-Jul-06 23:37
Hamid_RT21-Jul-06 23:37 
QuestionC# to C++ inter operating Pin
SameepSheth12365421-Jul-06 10:48
SameepSheth12365421-Jul-06 10:48 

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.