4 ms·
Because memory management is an area where C++ over-simplifies and assumes one size fits all. In the C++ worldview, memory allocation is a black box, and no two
by xamuel 8y ago
Because memory management is an area where C++ over-simplifies and assumes one size fits all. In the C++ worldview, memory allocation is a black box, and no two apps would ever have any desire to use different memory allocation strategies. For many apps, that's fine, but for the type of apps where C shines, memory allocation isn't just a magic black box.
"As simple as possible, but no simpler."
- geezerjay 8y ago> Because memory management is an area where C++ over-simplifies and assumes one size fits all. And the fact is that it does. In the rare case that it doesn't then C++ also accomosdates those requirements if developers are willing to put in the same sort of effort that goes into implementing data structures by hand.
- pjmlp 8y agoNo it doesn't. In fact C++ allows for flexible memory allocation strategies per data structure, while C forces one to hand code them all and replacing something like malloc affects the whole executable behavior.
- jstimpfle 8y ago> flexible memory allocation strategies per data structure You realize that that's not exactly flexible. Tieing shape to behaviour in this way is where the pain starts.
- pjmlp 8y agoOverloading new/delete, STL allocators, <build your own while giving it as template parameter>, not sure they tie shape to behavior.
- jstimpfle 8y agoHere, shape = type. Yes, they do. Start thinking why C++ compilation times are so abysmal? Because of this dependency mess. Then realize the same inefficiencies apply to maintainers' heads.