logoalt Hacker News

embedding-shapeyesterday at 8:11 AM4 repliesview on HN

Does C also have a compiler that turns C code into assembly before the real runtime does its work? Never done much C development in the past, didn't get the impression it worked like that.


Replies

OJFordyesterday at 10:14 AM

> Does C also have a compiler that turns C code into assembly

Yes, that's 'a C compiler', like gcc.

> before the real runtime does its work

Sort of, the program is 'the runtime', but this is backwards, languages that have 'a runtime' get the name from it running at runtime to compile/interpret source or byte code. In C what runs at runtime is just your program, whatever you compiled. (Maybe it's an interpreter though!)

show 1 reply
messeyesterday at 9:01 AM

> Does C also have a compiler that turns C code into assembly before the real runtime does its work?

What do you think ahead of time compilation is?

throawayontheyesterday at 12:08 PM

a c compiler turns c code into assembly which is then consumed by an assembler(?)

IceDaneyesterday at 9:00 AM

You can output assembly with any toolchain, yes. But there's no runtime, at least if you mean in the sense that the code is executed by a runtime.