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??
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??
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."-Bjarne Stroustrup
Nearing the end of finishing my 2D card game! I have to work on its 'manifesto' though <_<
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 =)
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."-Bjarne Stroustrup
Nearing the end of finishing my 2D card game! I have to work on its 'manifesto' though <_<
If I was a smart compiler, I would optimize the whole program into nothing, since that's basically what it does.
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
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.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law