Can someone help me with a couple of general questions about the linker?
My understanding is that when I compile some code the linker will examine the code and spot if a function is used or not and then not bother compiling it if nothing uses it? So if I write functionA() but never actually use it, then it won't get compiled - is this correct?
What I want to know is how thoroughly the linker checks. Say I have functions a(), b() and c(), and these are used exclusively by functions one(), two() and three() which are all used exclusively by z() only. If I don't actually use z() is the linker smart enough to know that it doesn't need to bother including any of the other functions?
Also if a function is only called by a impossible circumstance (for example if(1==2) ) is the linker smart enough to spot that the function will never be called, and therefore won't be compiled?
Finally, is there anyway I can check what has / hasn't been included? are any intermediate files created that I can check to see what functions have actually been included?