Call by value
Call by value is a parameter-passing semantics in which a called operation receives its own copy of an argument’s 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 call 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.
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 call by value →
Related concepts
- range loopproduced by · A range loop is a Go for-loop form that iterates over values or entries produced by a supported rangeable expression.
- structused by · A struct is a composite data type or structure that groups related fields or values into a single unit.
- array parametercontrasts with · An array parameter is a C function parameter declared with array syntax that is adjusted to a pointer to its element type.
- function argumentuses · A function argument is a value or expression supplied when a function or method is invoked, providing input to the called operation.
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.


