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,559 of 33,346   
   curently Unemployed to All   
   Proposing automatic move in static array   
   25 Sep 12 07:35:41   
   
   From: neuralll@googlemail.com   
      
   { Reformatted; please limit your lines to 70 characters - mod }   
      
      
   Skyscrapper city[1000];                         // instead of temp   
   city[1] = Skyscrapper("Empire State Building"); // compiller should use   
                                                    // &city[1] as this pointer   
      
   This would fix heap and static(which && can't) waste = zero   
   alloc/copy.  Majority of objects are small thus majority of their   
   memory is static.   
      
   ...After all those attempts to store anything via = without waste I   
   think that compiller should do "placement new" transparently in this   
   particular case.  Instead of forcing us to implement zillion &&   
   operators that solve only heap side of problem. Deciding what kind of   
   "this" object should use in constructor is easy since static analysis   
   deciding what object is movable is already part of new compillers as   
   part of support for &&.   
      
   So whole behavior of such code is already defined by placement new   
   part of iso standard. Only change would be calling placement   
   destructor first (adds nice reintialization to c++ I always missed).   
   And operators =& (static+dynamic) copy or =&&(static)copy(dynamic)move   
   not being called is not bug since geting rid of inefficient and   
   redundant steps during static array creation was whole point.   
      
   Benchmark results showing how big such change would be in compiller   
   with such optimization switch can be deduced from article www   
   codeproject   
   com/Articles/453022/The-new-Cplusplus-11-rvalue-reference-and-why-you#fix   
      
   Advantages as oposed to writing zillion of operators or constructors   
   is old and new code will get huge performance boost on objects with   
   big static or dynamic arrays with memory just by recompiling.   
      
      
   Regards Ladislav Nevery [Unemployed]   
   neuralll[@]gmail[.]com   
      
      
   --   
         [ 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