Cplusplus: Difference between revisions

Jump to navigation Jump to search
m
opcode only specifies an instruction. Machine code (of which assembly language is a human-readable representation) is accurate.
(remove some of the crap)
m (opcode only specifies an instruction. Machine code (of which assembly language is a human-readable representation) is accurate.)
 
Line 11: Line 11:
The page [[Programming On Redbrick]] explains how to compile programs written in C++. Here we will go  into more depth as to how the compiler g++ works.
The page [[Programming On Redbrick]] explains how to compile programs written in C++. Here we will go  into more depth as to how the compiler g++ works.


A compiler works by translating your programming language (in this case, C++) into opcode, which is the basic language that a processor understands. While C++ is a universal language (source code written on one architecture will generally work on another unless special libraries are used), programs must be recompiled if they are to be used on different architectures - for example, if you are compiling on murphy, which uses the UltraSPARC architecture, you will have to recompile your program if you wish to use it on carbon or deathray, which use the Intel x86 architecture, because UltraSPARC and x86 assembly languages are completely different.
A compiler works by translating your programming language (in this case, C++) into machine code, which is the basic language that a processor understands. While C++ is a universal language (source code written on one architecture will generally work on another unless special libraries are used), programs must be recompiled if they are to be used on different architectures - for example, if you are compiling on murphy, which uses the UltraSPARC architecture, you will have to recompile your program if you wish to use it on carbon or deathray, which use the Intel x86 architecture, because UltraSPARC and x86 assembly languages are completely different.


g++ is the free, open-source C++ compiler which is included with many distributions of Linux as part of the gcc package, the latter of which is a C compiler. Other popular C++ compilers include Borland C++ and Microsoft Visual C++, however these are proprietary. gcc (and g++) is the most widely ported and universally available compiler in the world.
g++ is the free, open-source C++ compiler which is included with many distributions of Linux as part of the gcc package, the latter of which is a C compiler. Other popular C++ compilers include Borland C++ and Microsoft Visual C++, however these are proprietary. gcc (and g++) is the most widely ported and universally available compiler in the world.
244

edits

Navigation menu