10-02-2012, 02:32 PM
Low-Level Programming in C
Menu
PS5
C Programming Language
Pointers in C
Pointer Arithmetic
Type checking in C
Why is garbage collection hard in C?
PS5
Will return in section tomorrow
Some very impressive projects!
Will be posted on the course web site soon
Many people demonstrated ability to figure out complicated new things on their own (not a requirement for PS5)
Stapling penalty for PS6 will be 25 points
Programming Languages Phylogeny
C Programming Language
Developed to build Unix operating system
Main design considerations:
Compiler size: needed to run on PDP-11 with 24KB of memory (Algol60 was too big to fit)
Code size: needed to implement the whole OS and applications with little memory
Performance
Portability
Little (if any consideration):
Security, robustness, maintainability
C Language
No support for:
Array bounds checking
Null dereferences checking
Data abstraction, subtyping, inheritance
Exceptions
Automatic memory management
Program crashes (or worse) when something bad happens
Lots of syntactically legal programs have undefined behavior
Example C Program
Type Checking isn’t Enough…
= vs. :=
Why does Java use = for assignment?
Algol (designed for elegance for presenting algorithms) used :=
CPL and BCPL based on Algol, used :=
Thompson and Ritchie had a small computer to implement B, saved space by using = instead
C was successor to B (also on small computer)
C++’s main design goal was backwards compatibility with C
Java’s main design goal was surface similarity with C++