|
-
August 25th, 2010, 02:55 AM
#1
Pass-by-value vs pass-by-reference
From a multithreaded and multi-processor/core perspective, what would be safer, pass-by-value or pass-by-reference?
I know there's no hard and fast rules, but what would you consider as a general guideline?
To me it feels that pass-by-reference is more risky in a multithreaded environment. Another thread can modify an object while a function is busy operating on it. Using pass-by-value decreases the chance of a mess happening. The downside of course is the overhead associated with passing large objects by value.
Last edited by links; August 25th, 2010 at 02:58 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|