|
> From: Jim Langston > > Actually, even with your given scenario, it is possible to still pass a > pointer and have the calling function change the memory size. Using C it > could malloc/demalloc/remalloc. But the pointer would be "owned" by the > calling function, not the called function. That's entirely opposite of what I said. If the calling method is performing the allocation, it needs to know the size, and thus is not OO. > Given this, when would you see a good time to return a pointer to memory > "owned" by a called function? If I were returning pointers to statically defined objects in the called method, or to memory allocated by the called method (such as a cache). I think I was pretty clear about this. Joe
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.