3 ms·
> Even C has a runtime, whose assumptions can be violated quite thoroughly by other languages. C has a little wrapper around main(), and it has a standard libr
by haberman 13y ago
> Even C has a runtime, whose assumptions can be violated quite thoroughly by other languages.
C has a little wrapper around main(), and it has a standard library, but it has no runtime to speak of.
- qznc 13y agoThe C runtime consists of stuff like malloc and free. Newer versions of C also require support for thread-local storage for example. It is not a lot, but there definitly is a small runtime called libc. Of course, the C standard also defines the freestanding variant, but there is not even main() anymore.
- justincormack 13y agoIts barely a runtime though. I prefer to view Unix as the runtime for C...
- haberman 13y agoA standard library is not the same as a runtime. A library you explicitly call out to, and if you do not call it you can avoid linking the library at all. A runtime inserts calls to itself in a way that cannot be reasonably avoided, and must therefore be linked/loaded by every program.
- tokenrove 13y agoThat little wrapper is a runtime (after all, what does crt stand for?); depending on the platform, it's certainly not so negligible that you can say it doesn't exist.
- haberman 13y agoIt is not a runtime in the ways that matter. After it has transferred control to the user program, it is gone completely; it never inserts itself into the program's execution. It is more like the loader or dynamic linker of the OS than like the runtime of other languages. If you have your own mechanism for transferring control to the C program you don't need the main() wrapper at all.