home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,111 of 33,346   
   Alf P. Steinbach to All   
   Re: Why is there no input value optimiza   
   10 Apr 12 11:51:54   
   
   From: alf.p.steinbach+usenet@gmail.com   
      
   On 10.04.2012 19:53, Daniel Krügler wrote:   
   > On 2012-04-10 11:18, rossmpublic@gmail.com wrote:   
   >> I have a very simple question that I have been unable to find a   
   >> satisfactory answer. The question is why do I need to manually   
   >> optimize my functions using const references?   
   >>   
   [snip]   
   >   
   > For function parameters, the compiler cannot apply this logic: When   
   > the function is called, the compiler must assume that the actual   
   > parameters are still in use (If we have a C++11 compiler and the an   
   > rvalue argument, this argument value can be moved. But it seems to   
   > me that your concern is not related to move semantics). It would   
   > require that the compiler performs tracking of each argument   
   > *within* the function (This is different from RVO, where the   
   > compiler can ignore the different views) to recognice whether they   
   > are modified or not. Only if not, the compiler could elide the   
   > copy. Except for very simple examples this is generally not   
   > feasible.   
      
   Uhm, you are envisioning one impractical way to do things. From that   
   you imply that any solution must be infeasible. At least that's how I   
   read it (for otherwise it would be meaningless), and that's a fallacy.   
      
      
   Cheers & hth.,   
      
   - Alf   
      
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca