CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Apr 2007
    Location
    South Africa
    Posts
    86

    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
  •  





Click Here to Expand Forum to Full Width

Featured