nexos wrote:
Overall, C itself appears to be a freestanding language with no dependencies.
What do you mean by dependency here? A library you always have to link in or else the thing doesn't work? Because all C implementations I know have those. And if not, then I really don't know what you'd describe, say, FreePascal's runtime as. There is no difference, other than size.
sj95126 wrote:
main() that doesn't invoke any functions shouldn't need any call instructions. Theoretically, you could implement simple "subroutines" with gotos. There may be architectures I don't know in detail where this can't work.
Even then, stack is required for the code that will end up calling the main() function. Depending on architecture, call instructions (or closest equivalent) are going to be necessary to establish GOT pointers, or else you cannot even access your global variables. And your automatic variables might end up on stack anyway, depending on architecture, available registers, and whether or not the compiler decides to spill. Thanks to the ABI, the decision may be out of the compiler's and, anyway. Remember, the i386 ABI gives you 3 free registers to work with. Even if you have lots of registers (like on PowerPC, where you have 32 registers), you might be hobbled by the ABI, which only allows you to use 11 of them without saving. main() might be the outermost layer of your application, but there is still something that called that function from the implementation, and therefore most ABIs make absolutely no special exception for main() regarding register usage.
So yes, even the simplest programs will require stack.
Besides, without something like a Wheeler jump being possible (and it isn't possible portably in C), your "subroutines" cannot return from whence they came. They can only "return" to a single place.