deep or shallow copying?

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/09 16:02 UTC
Read the original article Hit count: 200

Filed under:
|

Dear all. I was wondering if there are examples of situations where you would purposefully pass an argument by value (deep copy) in C. For instance, passing a char to a function is usually cheaper in space than passing a char* (if there's no need to share the value), since char is 1 byte and pointers are, well, whatever they are in the architecture (4 in my 32 bit machine). ?(When) do you want to pass (big) deep copies to functions? if so, why?

© Stack Overflow or respective owner

Related posts about c

    Related posts about copy