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,115 of 33,346    |
|    Francis Glassborow to Martin B.    |
|    Re: Why is there no input value optimiza    |
|    11 Apr 12 09:56:13    |
      From: francis.glassborow@btinternet.com              On 10/04/2012 22:38, Martin B. wrote:       > On 10.04.2012 20:00, Ulrich Eckhardt wrote:       >> Am 10.04.2012 11:18, schrieb rossmpublic@gmail.com:       >>> 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?       >>>       >>> For example:       >>> ...       >>       >> Even worse:       >> ...       >>       >> The performance of course depends on the actual implementation, but       >> in common implementations a reference is just a "self-dereferencing       >> pointer", so a reference requires another level of       >> indirection. Also, any function can cheat and const_cast, so a       >> calling function must not assume that the call doesn't modify the       >> passed object. ...       >       > Interesting point. Who at which level is required to assume that       > something passed by const-ref is modified by the callee?              Which reminds me that C++11 supports concurrency. Pass by value only       needs unique access at the call site, pass by const reference requires       it throughout the life of the function call.              Francis                     --        [ 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