View Single Post
Old Oct 28th, 2005, 9:55 AM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
The problem is that the C++ containers seem to reallocate memory when stuff is added to them or when they are copied.
You can defer this action, reduce the number of incidences, whatever, by simply setting a larger than (immediately) necessary size on the first usage. If the owner of your company doesn't understand enough about the existing STL to use it advantageously, I doubt the owner of your company understands enough about the issues to rewrite it. What do you think?
Quote:
Our client does not like this memory reallocation, he thinks it's possibly dangerous and would like us to do something about it.
Clients may rule the day, but the aren't always right. When they aren't it's someone's job to educate them with a rational approach. Does your client really know what he's talking about? Does the owner of your company? Someone needs to. Otherwise, it's the blind leading the blind, and you both fall and bitch (or however that old saying goes).
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline