That's an implementation detail of the function you're calling, not a performance issue at the call site. The call site should not have an opinion on this. Either the object is big enough it should be pass-by-reference, or it's not. You don't need to sprinkle that detail at every call site.
> You mostly care whether it's by value or by reference because what is passed could be altered with the latter unless it's marked const.
For mutable parameters I agree, those should be passed by pointer. Because they actually have an influence at the call site.
But const references, which is what we were talking about, have no behavior change at the call site. So they should not stand out or be marked special, since they aren't.
> But yeah some people are so smart that there is literally nothing in coding readability they need and sneer at those of us who take a different approach.
If you insist all pass-by-const-refs should be pass-by-pointer then you've also lost your ability to code-style distinguish mutable vs. non-mutable parameters. Which makes it much easier to make mistakes, not harder. And also litters your code base with meaningless, non-behavior-altering noise.
Your example in Rust would read like this:
// Definition
fn foo(a: u8, b: &u8, c: &mut u8) -> i32 {
a = 0; // Local change only
println!("{}", *b); // Read pointee
*c = 1; // Write pointee
return 2;
}
// Call site
let bar: u8 = 3;
let baz: u8 = 4;
let mut bajinga: u8 = 5;
foo(bar, &baz, &mut bajinga);
You mostly care whether it's by value or by reference because what is passed could be altered with the latter unless it's marked const. But which is it? Stop! Stop what you're reading right now and go and look at the foo() signature. 9 times in 10 you won't be surprised, the arguments should not be altered by the function call but you might want to check that, then get back to whatever you were actually trying to understand with a break in the flow of your understanding and the prospect of some context fading slightly from your short term memory.
But yeah some people are so smart that there is literally nothing in coding readability they need and sneer at those of us who take a different approach. Such people never make mistakes. Twas ever thus, well before C++.