View Single Post
rcgldr
rcgldr is offline
#14
Nov13-11, 01:42 PM
HW Helper
P: 6,925
Quote Quote by rcgldr View Post
The issue here is that the C compliler will include machine code to call main(), and also all of the code required for printf().
Quote Quote by MisterX View Post
This is implementation specific, but in many cases, the entire code for printf is not included by the compiler.
It wasn't clear to me if the original poster was asking about object modules which include external links to be resolved by the linker, or was asking about executables, which would include library code (or overlay handlers). The compiler would at least need to generate the code required to call printf().

Quote Quote by MisterX View Post
No, that't not what I meant. But, I'm sure compilers have been made using the C language, such as gcc which was "written primarily in C".
How was the initial gcc compiler created? You'd need an existing C compiler in order to compile C code. I mentioned this above, that this is either done by cross compiling from another machine, or by creating the initial version of a compiler in a language already supported by the target machine.

As an early example, Altair Basic's roots go back to an 8008/8080 emulator that ran on a PDP-10. The paper tape loader mentioned in the wiki article had to be toggled into memory using the Altair's front panel:

http://en.wikipedia.org/wiki/Altair_BASIC