The Language Hierarchy: electrons to web

CS 301: Assembly Language Programming Lecture, Dr. Lawlor

You can think of a computer as running very simple low-level operations like moving electrons, or as running very high-level operations like looking at a web page.  The appropriate level depends on what you're trying to achieve, but it's useful to know at least a little about all the levels.

Field guide: C versus C++

Plain C is a simple, low-level language, and it's nearly a subset of C++, which was originally named "C with classes".  If you look at the size of the author's book on each language, you can immediately see the big complexity difference!

C textbook Kernigan and Ritchie, a thin paperback, versus
      Straustrup's Ocean Book on C++, a thick hardback.

Generally, these features are shared between C and C++:

These features are only C++, not available in plain C:

In this class, we'll be covering both the implementation of C++ features in plain C and assembly, and plain C as a language on its own.  Quite a few large projects are built in plain C, including the linux kernel, and many system libraries.


Field guide: assembly versus machine code

Machine code is the raw binary data that the CPU executes.  The individual bits of machine code are the actual inputs to the transistors in the CPU's control system that make the CPU eventually (many stages later!) compute stuff.

Assembly language is a human-readable version of machine code.

If you compile a simple function that just does "return 7;", you can see assembly language instructions "mov" and "ret", and the binary machine code that the CPU actually runs. (Hit the "Disassemble" checkbox on NetRun to see this yourself; we'll be covering this starting next week.)

0000000000000000 <foo>:
   0:	b8 07 00 00 00       	mov    eax,0x7
   5:	c3                   	ret   
Machine Code (in hex) Assembly Language