Top "Pass-by-value" questions

pass-by-value is a "one way passing" so that modifications of the passed value inside the receiving function (or other entity like process, etc) are not returned back.

Is the pass-by-value-and-then-move construct a bad idiom?

Since we have move semantics in C++, nowadays it is usual to do void set_a(A a) { _a = std::…

c++ c++11 move-semantics pass-by-value rvalue-reference
Passing objects by reference vs value

I just want to check my understanding of C#'s ways of handling things, before I delve too deeply into …

c# parameter-passing pass-by-reference pass-by-value
C# pass by value vs. pass by reference

Consider the following code (I have purposefully written MyPoint to be a reference type for this example) public class MyPoint { …

c# pass-by-reference pass-by-value value-type reference-type
Where should I prefer pass-by-reference or pass-by-value?

In what circumstances should I prefer pass-by-reference? Pass-by-value?

c++ function pass-by-reference pass-by-value
How to access variable by id?

Possible Duplicate: Get object by id()? >>> var = 'I need to be accessed by id!' >>&…

python pointers reference pass-by-reference pass-by-value
Is it a good practice to change arguments in Java

Suppose I am writing a method foo(int i) in Java. Since i is passed by value it is safe …

java pass-by-value
Why are objects automatically passed by reference?

I have a general question about deep- and shallow-copy in the context of the pass-by-reference- and pass-by-value-concept of C#: In …

c# clone pass-by-reference pass-by-value shallow-copy
C++ Call by reference

If I have a function which takes a pointer to an integer, and I pass a reference to an integer …

c++ function pass-by-reference pass-by-value pass-by-pointer
Updating pointers in a function

I am passing a pointer a function that updates it. However when the function returns the pointer it returns to …

c function pointers pass-by-value
Best form for constructors? Pass by value or reference?

I'm wondering the best form for my constructors. Here is some sample code: class Y { ... } class X { public: X(const …

c++ constructor pass-by-value rvalue rvalue-reference