This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] coalesce stack slots


Richard Henderson wrote:
> That and Nathan [Sidwell]'s VEC's appear to only be able to 
> "add N to the current size" rather than "set total size to N".  
> At which point I quit looking.

When we were designing the reserve() member of the C++ standard 
library template std::vector<>, several people thought its argument 
should be relative to the current capacity, but I insisted that 
reserve's argument should become the absolute capacity of the 
vector.  (After a reserve() call, an append() is guaranteed not 
to trigger a reallocation if all the elements fit in the reserved 
size.)

I "won", but I still find it hard to articulate precisely why it
was right.  If you can explain it, posterity might benefit.

Nathan Myers


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]