Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You missed the part in strlen's comment where strlen says that every non-primitive value is a pointer. This also explains the behavior that you describe, with the caller's version of a variable being modified by a callee.

However, this is different than pass-by-reference. With pass-by-reference, if i assign a new value to the callee argument variable, that value also replaces the value in the caller. This is not true in java/python/ruby where it is termed "call by sharing" http://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sha...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: