|
Steve Richter wrote:
You can easily return a reference to an object in C or C++ via a pointer (*) or in C++ specifically via a reference (&). You can remove a member from a list/collection by unlinking its pointers from the list and returning a pointer to the object if you want to use it or using "delete" on it if you just want to deallocate it. Neither of these require copying the object. None of the things you mention here are properties of "managed code." What managed code does for you, basically, is handle the memory allocation/deallocation dynamically without your having to invoke new, malloc, delete, or free.The reason is managed code. Managed code allows the programmer to do two core functions with ease. Return an object from a function call without the necessity of copying all the bytes of the object ( in c# you return a reference to the object. in traditional languages like c++ and rpg you return a copy of the object ). By the same mechanism, managed code allows an object to be added and removed from a collection or list without the performance penalty of having to copy the object.
-- Kyle S. Goodwin Extensicom LLC
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.