Click here to Skip to main content
15,906,947 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRetrive JavaScript data from C++ Pin
theallmightycpd27-Dec-07 5:26
theallmightycpd27-Dec-07 5:26 
GeneralRe: Retrive JavaScript data from C++ Pin
Hakan Bulut28-Dec-07 7:25
Hakan Bulut28-Dec-07 7:25 
Generalput try...catch... in a loop Pin
followait27-Dec-07 4:03
followait27-Dec-07 4:03 
GeneralRe: put try...catch... in a loop Pin
CPallini27-Dec-07 4:19
mveCPallini27-Dec-07 4:19 
QuestionRe: put try...catch... in a loop Pin
David Crow27-Dec-07 4:21
David Crow27-Dec-07 4:21 
GeneralRe: put try...catch... in a loop Pin
followait27-Dec-07 4:30
followait27-Dec-07 4:30 
GeneralRe: put try...catch... in a loop Pin
Maxwell Chen27-Dec-07 4:28
Maxwell Chen27-Dec-07 4:28 
Generalwhy visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 2:24
George_George27-Dec-07 2:24 
Hello everyone,


Why visual studio does not optimize constructor in this case? I do not understand what the MSDN mentioned,

if use different named object, compiler can not optimize. Why?

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

class RVO
{
public:
       
            RVO(){printf("I am in constructor\n");}
            RVO (const RVO& c_RVO) {printf ("I am in copy constructor\n");}
            int mem_var;       
};
RVO MyMethod (int i)
{
            RVO rvo;
            rvo.mem_var = i;
      if (rvo.mem_var == 10)
         return (RVO());
            return (rvo); 
}
int main()
{
            RVO rvo;
            rvo=MyMethod(5);
}


Output is,

I am in constructor
I am in constructor
I am in copy constructor

My expected output is,

I am in constructor
I am in constructor


thanks in advance,
George
GeneralRe: why visual studio does not optimize constructor in this case Pin
Maximilien27-Dec-07 4:03
Maximilien27-Dec-07 4:03 
GeneralRe: why visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 4:10
George_George27-Dec-07 4:10 
GeneralRe: why visual studio does not optimize constructor in this case Pin
Maxwell Chen27-Dec-07 4:20
Maxwell Chen27-Dec-07 4:20 
GeneralRe: why visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 16:49
George_George27-Dec-07 16:49 
GeneralRe: why visual studio does not optimize constructor in this case Pin
Maxwell Chen27-Dec-07 4:11
Maxwell Chen27-Dec-07 4:11 
GeneralRe: why visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 16:36
George_George27-Dec-07 16:36 
GeneralRe: why visual studio does not optimize constructor in this case Pin
Maxwell Chen27-Dec-07 17:56
Maxwell Chen27-Dec-07 17:56 
GeneralRe: why visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 18:15
George_George27-Dec-07 18:15 
GeneralRe: why visual studio does not optimize constructor in this case Pin
Sarath C27-Dec-07 4:55
Sarath C27-Dec-07 4:55 
GeneralRe: why visual studio does not optimize constructor in this case Pin
George_George27-Dec-07 16:42
George_George27-Dec-07 16:42 
GeneralRe: why visual studio does not optimize constructor in this case Pin
Sarath C27-Dec-07 19:15
Sarath C27-Dec-07 19:15 
Questioncan anybody explain me the reason for this for loop Pin
Deepu Antony27-Dec-07 2:06
Deepu Antony27-Dec-07 2:06 
AnswerRe: can anybody explain me the reason for this for loop Pin
CPallini27-Dec-07 2:16
mveCPallini27-Dec-07 2:16 
AnswerRe: can anybody explain me the reason for this for loop Pin
PJ Arends27-Dec-07 2:17
professionalPJ Arends27-Dec-07 2:17 
AnswerRe: can anybody explain me the reason for this for loop Pin
David Crow27-Dec-07 2:17
David Crow27-Dec-07 2:17 
GeneralRe: can anybody explain me the reason for this for loop Pin
Deepu Antony27-Dec-07 3:03
Deepu Antony27-Dec-07 3:03 
QuestionHow can i make some EDIT line read only and leave the color of the control in WITHE color ? Pin
Yanshof27-Dec-07 1:50
Yanshof27-Dec-07 1:50 

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.