Quote:Original post by m0nkfish
Is there any (semantic) difference between the following methods of passing by reference:
The main semantic difference between your two snippets is the first is passing by value and the second is passing by reference.
Passing by value and passing by reference have quite marked semantic differences, as any first-year textbook on computer science should tell you. At least it did back in my day, but that was long loooong ago. Maybe, since the invention of the PC, things like that just don't matter so much anymore.
What might confuse you is that before your first snippet's Foo function call, you are taking the address of a local variable. You then pass that address by value to Foo, which likely performs various operations on that address like dereferencing it. In your second snippet, you pass your local variable by reference and Foo likely performs various operations on it.
Ya know, the semantics of the two snippets are about as similar as dogs and rainbows.