#000 – How C++ actually runs spoke about how our C++ code gets converted into machine code, allowing our programs to execute on hardware.
Low-level languages operate directly with hardware. This includes registers and the CPU’s Instruction Set (ISA). Thus, a programmer must be familiar with these domains to … program.
Conversely, high-level languages abstract all the hardware away, allowing the programmer to focus on the code.
For the instruction a = 97;, the programmer doesn’t need to specify where in memory this is stored or the specific machine code instruction required to perform this task. The compiler does this work for us!
This allows us to develop programs that are cross-platform, or platform-agnostic because the ISA of each CPU architecture (ARM, x86 etc.) are different because of business reasons. As you can imagine, changing our program to suit a different CPU gets tiresome (and it’s costly).
High-level languages provide other benefits such as:
- Programs that are easier to write, read and learn since they resemble human language.
- High-level languages are more efficient, requiring fewer instructions to perform the same tasks as low-level languages. In C++ you can write
a = b * 2 + 5;in one line. In assembly language, this would take 4 to 6 different instructions. - Programs written using high-level languages are more concise, which makes them easier to understand.
C++ is nuanced as it provides the programmer the freedom to use the language in low-level and high-level contexts. You can choose to operate at a lower level for better performance and precision, or at a higher level for greater convenience and simplicity.
Thus, it cannot strictly be classified as a low or high-level language.