Top "Pass-by-reference" questions

Pass by reference is an argument marshalling strategy whereby a variable's location in memory is passed to a function, rather than a copy of the variable's value, although the function appears in the source code to receive the variable itself rather than a pointer to it.

Which is more efficient: Return a value vs. Pass by reference?

I am currently studying how to write efficient C++ code, and on the matter of function calls, a question comes …

c++ performance function return-value pass-by-reference
Performance cost of passing by value vs. by reference or by pointer?

Let's consider an object foo (which may be an int, a double, a custom struct, a class, whatever). My understanding …

c++ pointers pass-by-reference pass-by-value pass-by-pointer
What exactly is the difference between "pass by reference" in C and in C++?

The phrase "pass by reference" is used by C and C++ developers alike but they appear to be used to …

c++ c terminology pass-by-reference pass-by-value
Does Swift have something like "ref" keyword that forces parameter to be passed by reference?

In Swift, structs and value types are passed by value by default, just like in C#. But C# also has …

pass-by-reference swift
Is it possible to pass properties as "out" or "ref" parameters?

Can I pass a property as an "out" or "ref" parameter if not then why not? e.g. Person p = …

c# arguments pass-by-reference
When to pass-by-reference in PHP

Im wondering if its good practice to pass-by-reference when you are only reading a variable, or if it should always …

php pass-by-reference
Pass by value faster than pass by reference

I made a simple program in c++ to compare performance between two approaches - pass by value and pass by …

c++ pass-by-reference pass-by-value
Reference found where even-sized list expected in Perl - Possible pass-by-reference error?

I have a Perl class/module that I created to display Bible verses. In it there is a hash that …

perl oop hash pass-by-reference hashref
Go: invalid operation - type *map[key]value does not support indexing

I'm trying to write a function that modifies original map that is passed by pointer but Go does not allow …

go pass-by-reference
'pass parameter by reference' in Ruby?

In Ruby, is it possible to pass by reference a parameter with value-type semantics (e.g. a Fixnum)? I'm looking …

ruby parameter-passing pass-by-reference