r/computerscience • • Jul 17 '18

computer science

Post image
443 Upvotes

27 comments sorted by

View all comments

Show parent comments

6

u/zerocnc Jul 17 '18

Would it be missing byte code and object code?

12

u/[deleted] Jul 17 '18

Well JavaScript doesn't usually compile to C++ code (it's interpreted) and C++ doesn't compile to C I believe. The product of the Java compiler is called Byte Code and is interpreted by the virtual machine.

6

u/Silbern_ Jul 17 '18

C++ doesn't compile to C I believe

You're correct; traditionally C and C++ both compile to assembly, which is then compiled to machine code. C++ doesn't pass through C on the way there. And since C++ and C are increasingly moving further and further apart, that almost certainly won't change anytime soon :P

-2

u/Calandas Jul 18 '18

> You're correct; traditionally C and C++ both compile to assembly

I'm not sure about this, but don't both of them compile directly to machine code and only offer to generate the assembly version?

1

u/TokeyMcGee Jul 19 '18

Fair question, gcc or g++ compile to assembly(.s), then machine code(.o) and finally an executable (.exe). You have an option to save the .s as a separate file but it is always generated as part of the process.