Can I change the way functions work?

When you pass a variable to a function in a function call, the function makes a copy of the variable so that any changes made to the value of the variable only effects the copy. It's called pass-by-value and it's the default behavior of functions in c++.

Not only is this behavior non-intuitive, the copy functionality introduces some overhead that can seriously impact performance and the need to create a reference parameter in the function definition and then pass it a pointer is just all kinds of confusing and difficult to write and read.

What I want to do is change the default behavior to pass-by-reference, without the need to declare reference parameters or pass pointers as arguments in function calls. I could still make copies of the arguments inside the function and use the copies if I don't want to change the argument values.
I don't understand. First you say that pass-by-reference semantics are confusing and then you ask "can have I pass-by-reference semantics using pass-by-value syntax?".
So what's the deal? Why do you want something that you find confusing?

No, you can't redefine the syntax of the language at you whim. If you want to pass by reference then pass by reference; if you want to pass by value then pass by value.
duplicate question.
For fuck's sake.
Registered users can post here. Sign in or register to post.