WalderMort wrote:
but there are instances where using malloc has proved to be better
Sorry, WalderMort, I don't know what you're referring to by this statement. If you follow the link I provided in my previous post and scroll up a few lines, you will find this:
Stroustrup wrote:
There is no performance difference between malloc() and new when you take initialization into account.
In my humble opinion, if you find yourself in a situation where you think you benefit from the use of ::malloc() in C++, you're probably not using the language in the way Stroustrup intended. This is also how I interpret his statement a little bit further down:
Stroustrup wrote:
If you feel the need for realloc() - and many do - then consider using a standard library vector.
WalderMort wrote:
needing to allocatate an instance without calling the c'tor
I cannot possibly think that I will find myself in a situation where I actually want to use uninitalized data, the compiler would also complain about it. If you want to create a copy of an existing object, you don't use ::memcpy():omg: but you would rather use the copy constructor or the assignment operator. But that may be just me...:-> ...but I think not...
"It's supposed to be hard, otherwise anybody could do it!" - selfquote