liveBook · Manning

Pass by value

Also called passed by value, passing by value

Pass by value is a parameter-passing semantics in which a called operation receives a copy of an argument's value.

How 4 Manning books explain it

High Performance Unity Game Development

A parameter-passing behavior in which a function receives a copy of an argument's value.

How it is used
Identifies mutation bugs and copying costs when game-state structs are passed to C# functions.
How deep it goes
Explains copied values and references, works through ref and return-and-assign fixes, and qualifies struct-size measurements by runtime.
Examples
Demonstrates lost XP in a copied game-data struct and alternative ways to update a player-position struct.
What you can do after
Diagnose/debug with it by spotting copy-only updates, then use C# ref or return-and-assign when the caller needs the changed struct.

Read how High Performance Unity Game Development explains pass by value →

Object-Oriented Software Design in C++

A parameter-passing mechanism that initializes a function parameter with a copy of the argument value.

How it is used
Uses parameter passing to expose hidden copies and explain poor performance in vector-based C++ code.
How deep it goes
Traces copy construction, vector growth, allocation, and destruction, then stops short of a complete alternative design.
Examples
Demonstrates Date arguments passed to append and Appointments passed to print, using instrumented lifecycle output.
What you can do after
Diagnose performance problems by identifying unexpected copies, allocations, and destructions in instrumented C++ programs.

Read how Object-Oriented Software Design in C++ explains pass by value →

Go by Example

Pass-by-value is a parameter-passing semantics in which a function receives a copy of each argument's value.

How it is used
Uses copied Result values to process synchronous API results without unnecessary shared state.
How deep it goes
Explains value-versus-pointer semantics, mutation, goroutine isolation, allocation, stack use, caching, and garbage-collector trade-offs.
Examples
Uses Result, Send, SendN, yield, Results, and Summarize to demonstrate copied values in a result-processing pipeline.
What you can do after
Evaluate whether functions should receive Result values or pointers based on mutation, isolation, allocation, and garbage-collection concerns.

Read how Go by Example explains pass by value →

100 Go Mistakes and How to Avoid Them

A value copy is an independent value produced by copying another value rather than referring to the original value.

How it is used
Diagnoses failed mutations in Go range loops and guides the choice between value, index, and pointer access.
How deep it goes
Explains struct and pointer copying, then stops at practical slice-update patterns rather than language-runtime internals.
Examples
Uses account balances to contrast ineffective value-variable mutation with indexed and pointer-based updates.
What you can do after
Apply value-copy rules to choose a loop form that predictably mutates or preserves slice elements.

Read how 100 Go Mistakes and How to Avoid Them explains pass by value →

Also covered in

What to know first

Related concepts

Questions about pass by value

What is pass by value?

Pass by value is a parameter-passing semantics in which a called operation receives a copy of an argument's value.

Which Manning books explain pass by value?

High Performance Unity Game Development, Object-Oriented Software Design in C++, Go by Example and 100 Go Mistakes and How to Avoid Them.

What should I know before learning pass by value?

Manning books that teach pass by value usually introduce reference, primitive type, class and Map first.

What is the difference between pass by value and pass by reference?

Pass by value is a parameter-passing semantics in which a called operation receives a copy of an argument's value. Pass by reference is a parameter-passing mode in which a function receives access to the caller's argument through a shared reference rather than an independent copy.

What is pass by value a kind of?

Pass by value is a kind of input. An input is information, a value, or an action supplied to a system, program, or computation for processing or to influence its behavior.

What is pass by value also called?

Pass by value is also called passed by value or passing by value.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.