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

C / C++ / MFC

 
AnswerRe: How to remove the Tittlebar & Menu bar of a SDI application Pin
santhoshv8418-Dec-07 21:30
santhoshv8418-Dec-07 21:30 
AnswerTittlebar? Is that save for work? Pin
jhwurmbach18-Dec-07 23:26
jhwurmbach18-Dec-07 23:26 
GeneralDisconnecting from the internet programmtically Pin
emmmatty118-Dec-07 21:09
emmmatty118-Dec-07 21:09 
GeneralRe: Disconnecting from the internet programmtically Pin
David Crow19-Dec-07 3:15
David Crow19-Dec-07 3:15 
GeneralRe: Disconnecting from the internet programmtically Pin
jhwurmbach19-Dec-07 3:35
jhwurmbach19-Dec-07 3:35 
Questionwhy Visual Studio can not optimize the initialization code? Pin
George_George18-Dec-07 20:35
George_George18-Dec-07 20:35 
AnswerRe: why Visual Studio can not optimize the initialization code? Pin
Nelek18-Dec-07 22:17
protectorNelek18-Dec-07 22:17 
GeneralRe: why Visual Studio can not optimize the initialization code? Pin
George_George18-Dec-07 23:13
George_George18-Dec-07 23:13 
Hi Nelek,


Here is sample 2 code. I do not understand why if we optimize by /O2, there is still copy constructor invoked?

http://msdn2.microsoft.com/en-us/library/ms364057(vs.80).aspx[^]

Here is output,

A: I am in constructor
A: I am in constructor
B: I am in constructor
A: I am in copy constructor
B: I am in destructor
A: I am in destructor
A: I am in destructor
A: I am in destructor

class A {
  public:
    A() {printf ("A: I am in constructor\n");i = 1;}
    ~A() { printf ("A: I am in destructor\n"); i = 0;}
    A(const A& a) {printf ("A: I am in copy constructor\n"); i = a.i;}
    int i, x, w;
};
 class B {
  public:
    A a;
    B()  { printf ("B: I am in constructor\n");}
    ~B() { printf ("B: I am in destructor\n");}
    B(const B& b) { printf ("B: I am in copy constructor\n");}
};
A MyMethod()
{
    B* b = new B();
    A a = b->a;
    delete b;
    return (a);
}
int main()
{
    A a;
    a = MyMethod();
}



thanks in advance,
George
GeneralRe: why Visual Studio can not optimize the initialization code? Pin
jhwurmbach19-Dec-07 3:47
jhwurmbach19-Dec-07 3:47 
GeneralRe: why Visual Studio can not optimize the initialization code? Pin
George_George19-Dec-07 3:58
George_George19-Dec-07 3:58 
QuestionWhat is the Maximum size of WCHAR Pin
santhoshv8418-Dec-07 20:05
santhoshv8418-Dec-07 20:05 
AnswerRe: What is the Maximum size of WCHAR Pin
Don Box18-Dec-07 20:26
Don Box18-Dec-07 20:26 
AnswerRe: What is the Maximum size of WCHAR Pin
codeII18-Dec-07 20:31
codeII18-Dec-07 20:31 
AnswerRe: What is the Maximum size of WCHAR Pin
Peter Weyzen18-Dec-07 21:52
Peter Weyzen18-Dec-07 21:52 
AnswerRe: What is the Maximum size of WCHAR Pin
David Crow19-Dec-07 3:29
David Crow19-Dec-07 3:29 
Questionmy problem is related to file handling Pin
rajneshmalik18-Dec-07 20:05
rajneshmalik18-Dec-07 20:05 
GeneralRe: my problem is related to file handling [modified] Pin
Nelek18-Dec-07 22:15
protectorNelek18-Dec-07 22:15 
GeneralRe: my problem is related to file handling Pin
Iain Clarke, Warrior Programmer19-Dec-07 1:22
Iain Clarke, Warrior Programmer19-Dec-07 1:22 
GeneralRe: my problem is related to file handling Pin
Nelek19-Dec-07 1:49
protectorNelek19-Dec-07 1:49 
GeneralRe: my problem is related to file handling Pin
David Crow19-Dec-07 3:32
David Crow19-Dec-07 3:32 
GeneralSystem Restart Pin
Kiran Pinjala18-Dec-07 19:03
Kiran Pinjala18-Dec-07 19:03 
AnswerRe: System Restart Pin
Lim Bio Liong18-Dec-07 19:25
Lim Bio Liong18-Dec-07 19:25 
GeneralRe: System Restart Pin
Hamid_RT18-Dec-07 19:26
Hamid_RT18-Dec-07 19:26 
GeneralRe: System Restart Pin
Kiran Pinjala18-Dec-07 21:16
Kiran Pinjala18-Dec-07 21:16 
GeneralRe: System Restart Pin
Hamid_RT18-Dec-07 22:55
Hamid_RT18-Dec-07 22:55 

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.