When to pass by value?
Posted
by Dervin Thunk
on Stack Overflow
See other posts from Stack Overflow
or by Dervin Thunk
Published on 2010-06-09T16:01:00Z
Indexed on
2010/06/10
15:13 UTC
Read the original article
Hit count: 260
Dear all. I was wondering if there are examples of situations where you would purposefully pass an argument by value in C. Let me rephrase. When do you purposefully use C's pass-by-value for large objects? Or, when do you care that the object argument is fully copied in a local variable?
EDIT: Now that I think about it, if you can avoid pointers, then do. Nowadays, "deep" copying is possible for mostly everything in small apps, and shallow copying is more prone to pointer bugs. Maybe.
© Stack Overflow or respective owner