C++ Portability?How compiler makes it portable, though its finally converted into machine code?

Hello guys. I am pretty much a beginner in C++ programmer. Somewhere, I heard that C++ compiler do the job of converting the the code into assembly language to produce an object. I am not arguing that C++ isn't portable, I know there is a reason. What I mean is since assembly language are machine specific how in the earth, is C++ portable?
The compiler can compile the code to any assembly language not just one. So a program can be written once, then compiled multiple times... one for each target machine it wants to run on.
closed account (S6k9GNh0)
Technically, it doesn't need to compile to an assembly language.
Thank @Disch...Compilers are soooooooooo smart :)
@computerquip,is it?really? Then was what i heard a rumor?What do you mean by Technically?
Last edited on
There is a difference between "in most cases" and "in extreme/rare cases". There are a lot of things that are allowed to happen that generally don't happen. Computerquip s referring to an extreme/rare case.
closed account (S6k9GNh0)
While it is rare (if a case exists at all), it's good to keep in mind. It's false to say that a C/++ compiler must compile into assembly or machine code, contrary to what some tutorials lead you to believe!
Last edited on
Topic archived. No new replies allowed.