Reputation: 1167
Say I have a function that returns an int
. I don't store the value from the function call. I presume that it is not stored in memory and fades into the aether, but I don't know.
Thank you.
Upvotes: 1
Views: 785
Reputation: 490728
An int
return value will normally be stored in a register (e.g., EAX or RAX on 32-bit or 64-bit Intel, respectively).
It won't fade. It'll simply be overwritten when the compiler needs that register for some other purpose. If the function in question is expanded inline, the compiler may detect that the value isn't used, and elide the code to write or compute the value at all.
Upvotes: 9