consider this code
what happens to the value of add function in main() ??Code:int add(int x, int y);
int main()
{
add(5, 7);
return 0;
}
is it lost because we did not assign it to another variabl??
Printable View
consider this code
what happens to the value of add function in main() ??Code:int add(int x, int y);
int main()
{
add(5, 7);
return 0;
}
is it lost because we did not assign it to another variabl??
Pretty much, except obviously that won't compile unless you link to code that contains a definition of add() as declared.
i just omitted the definition to illustrate the problem really quick
just assume it's there =)
If I was a smart compiler, I would optimize the whole program into nothing, since that's basically what it does.
You'd have to be smart enough to prove that add() has no side effects, but aside from that, yeah. In fact, if add() is marked pure, most compilers will do just that.