4 ms·
Passing around potentially large objects by value is wasteful and prone to move / copy semantics. Most languages pass objects by reference (C# and Java chief a
by c-linkage 3y ago
Passing around potentially large objects by value is wasteful and prone to move / copy semantics.
Most languages pass objects by reference (C# and Java chief among them).
Still, if you really want to pass by value -- even though you'll likely end up with pointer ownership problems -- you just add a few functions to the API to do so.
Creating an opaque type on the stack can be done, you just need a little more work.