4 ms·
True, but a good C course should explain exactly those concepts and what kind of problems (in relation to assembly and other HLLs) was C meant to solve back at
by bluetomcat 4y ago
True, but a good C course should explain exactly those concepts and what kind of problems (in relation to assembly and other HLLs) was C meant to solve back at the time.
I would highlight the following:
* Structured programming support, which means nested loops and conditionals without a primary need for "goto" jumps, enabling a sense of "depth" that is missing in the "flat" world of assembly
* Expression-oriented syntax, meaning that operators (even those having a side-effect) return a value of a certain type, and can be nested, again enabling recursive program structure versus a flattened one
* Global symbol allocation and resolution, which means that a programmer uses names rather than addresses to refer to global variables and functions
* Abstraction over function calling conventions, which enables the programmer not to worry about function prologues and epilogues and the order of pushing arguments on the stack or in registers
* Automatic storage management, meaning that a function-scope local variable is used by the programmer with its name and the compiler decides whether to put it in a register or at a certain offset in the stack frame
* Rudimentary integer-based type system that has the distinction between a scalar and a fixed-size collection of scalars laid-out sequentially (arrays), and special integers called "pointers", supporting a different set of operations (dereferencing to a certain type and adding or subtracting other integers from them, without any safety guarantees whatsoever)
Nothing more, nothing less. Not understanding these foundations is the source of major pain.
- pjmlp 4y agoMacro Assemblers, which were never a thing in UNIX, do offer support for structured programming, see MASM, TASM, or going back to the days C was born, something like HLASM on IBM mainframes. Additionally many of the C features had already been sorted out in JOVIAL, NEWP, PL/I, BLISS among others about a decade before C was born. C was solving the issues of UNIX v3 design, that is all. Plenty of languages can be used to teach low level programming concepts.
- shadowofneptune 4y agoThe expression-ness of C really sets it apart from even its successors. Declarations look like expressions, everything does. You can see in C code from the time how heavily expressions are used. C++, Java, etc. all added a bunch of new keywords to the syntax that make it much more like Pascal or other 'normal' languages. The culture of those languages leans much more towards statements as well.