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,679 of 33,346    |
|    Martin Ba to All    |
|    Re: A new realloc() proposal    |
|    23 Nov 12 03:50:32    |
   
   From: 0xcdcdcdcd@gmx.at   
      
   On 23.11.2012 07:25, fmatthew5876 wrote:   
   > { Please limit your text to fit within 80 columns, preferably around 70,   
   > so that readers don't have to scroll horizontally to read each line.   
   > This article has been reformatted manually by the moderator. -mod }   
   >   
   >   
   > realloc() has a lot of problems:   
   >   
   > * It tries to do too many things, malloc, free, and reallocate in place   
   > * It doesn't work with C++ classes that need to be copy constructed when   
   > moved. It also doesn't work for any kind of C/C++ classes or structs   
   > that have internal pointers. This means all generic C++ containers have   
   > to do expensive copies on resize when they may not be necessary.   
   > * It forces you to accept a malloc, bit copy, and free behavior if the   
   > pointer can't be reallocated in place. The user may want to do   
   > something else if the buffer can't be resized.   
   > * It does not guarantee alignment if the original buffer was allocated   
   > with alloc_aligned() (C11).   
   >   
   > I propose the following:   
   >   
   > ....   
      
      
   Are you aware of:   
      
   http://mallocv2.wordpress.com/ - A Collaborative Latency Reducing   
   Enhancement Of The C/C++ malloc API   
      
   There is a proposal N1527 for the C language.   
      
   It seems there never was an official proposal for C++ though.   
      
      
   cheers,   
   Martin   
      
      
   --   
    [ 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