DEV Community


Discussion on: Is C still a high level language?

pentacular profile image

This is really not true at all.

A modern C compiler does quite a lot of interesting work to try to make C code competitive.

Things are reordered and elided and optimized in ways that are often surprising.

Consider what this does in C.

while (1);

If you think it requires the program to loop forever, you are mistaken. :)

Beyond that, there is a great deal that C cannot do which assembly can.

  1. C has no concept of registers (the register storage class just makes a variable unaddressable).

  2. C has no concept of op codes.

  3. C has no concept of the CPUs memory model -- C has a segmented memory model.

C programs run in the C Abstract Machine, and understanding this is essential to writing C programs that do not work only by accident.

Consider the following snippet -- what do you expect it to do in C?

  int i = 1;
  printf("%d, %d\n", i++, i);