[Scummvm-devel] CVS: "added extra flag to mixer so we don't use free() on new'd pointers"

Max Horn max at quendi.de
Sun Oct 26 06:10:22 CET 2003


Am Sonntag, 26.10.03 um 13:01 Uhr schrieb David Eriksson:

> Quoting Max Horn <max at quendi.de>:

[...]

>>>
>> So no, I am most definitely not suggesting that you free() memory
>> allocated via new. But rather, I wonder why you have to allocate a
>> buffer with new - it should be trivial to just use malloc() instead...
>
> It is very backwards to oppose the use of C++ in a C++ program.
>
> Joost made a very simple solution to a big problem in ScummVM. Using 
> malloc/free
> in a C++ program is just plain wrong, unless your development language 
> actually
> is "C with classes" instead of C++.
>
That's plain nonsense in my eyes. "new" is primarily meant to allocate 
objects (because it implicitly invokes the constructor for these 
objects, just like delete invokes the destructor). For data buffers, 
there is absolutely no reason not to use malloc/free, not even from a 
theoretical point of view.


> The way of perfection would be to change all uses of malloc/free in 
> ScummVM to
> new/delete,

NO! That's just silly nonsense. I am not commenting on the rest of the 
mail, but my opinion on it is exactly the same.


Max





More information about the Scummvm-devel mailing list