What's the difference between the heap and the free-store? The C++ Programming Language keeps on referring them interchangeably. There was as huge cry over this issue in C/C++ programmer's community in Orkut. I had to shoot a mail to Dr. Bjarne Stroustrup. Here's our conversation:
My Mail:
Dear Mr Stroustrup,
Sorry to disturb you again. You have mentioned several times in the TC++PL that 'new' allocates memory from the 'free store (or heap)'. There has been a huge cry on the C++ community at Orkut (that I am moderating) as to whether free-store is the same as heap. The argument given against is that Mr Herb Sutter has mentioned that the free-store is different from the heap:
http://www.gotw.ca/gotw/009.htm
and that global 'new' has nothing to do with the heap.
So, if so, why has TC++PL used 'free store (or heap)' instead of mentioning the use of 'heap' separately.
Waiting anxiously for the response.
Regards,
Zaman Bakshi
His Reply:
In other word, the "free store" vs "heap" distinction is Herb's attempt to distinguish malloc() allocation from new allocation.
>
> So, if so, why has TC++PL used 'free store (or heap)' instead of
> mentioning the use of 'heap' separately.
My Reply:
Thank you Mr. Stroustrup, I had inferred the same thing (about using free store as general -- or better, synonym -- term) and had explained the community. But, I had been requested to reconfirm.
With warm regards,
Zaman Bakshi
3 comments:
Even so
Directly in the purpose
Two wrongs don’t make a right.
Post a Comment