Both C and C++ specify behavior of your program in terms of an abstract machine.
my_func
's int param
exists in this abstract machine, and it is distinct from the my_inner_func
's int param
. They have separate identities. If you take the address of one and the address of the other, they are guaranteed to compare not-equal.
But if you don't take the address of either, neither need have an address.
If all you do to an int
is assign or initialize it, then use it to assign or initialize another int
, and the compiler can prove there is no defined way to reach the intermediate int
through indirection (like a pointer), then the intermediate int
need not exist on the actual target machine.
Some compilers have problems with doing this at link-time. Others do not.
Some operations will block the existence of that int
from being elided. Others will not.
I see nothing in your example that would require that intermediate int
to exist on the target machine.