PS> In the standard C++, I use the 'new' operator to allocate dynamic
memory,
PS> however, in DJGPP, I have read the INFO docs on new and it says the new
PS> operator used the 'malloc' function to allocate memory. Is it the true
an
PS> which one is better in DJGPP(new or malloc)?
YOU should always use new. A 'new' is not the same as a 'malloc'
because with a 'new', the compiler will also call the constructors. It
doesn't do that for malloc calls.
How the compiler choses to allocate the memory doesn't really matter too
much. A compiler can have two heaps, if it wants too, and always do the
new from the second heap. And the new could even be redefined to some
custom version that some class happens to need.
For a class, you should always call new and not malloc.
--- QScan/PCB v1.19b / 01-0162
---------------
* Origin: Jackalope Junction 501-785-5381 Ft Smith AR (1:3822/1)
|