This week is about data.
Make (build system) is a powerful tool.
bm : bm.o Stack.o gcc -o bm bm.o Stack.o bm.o : bm.c Stack.h gcc -c -Wall -Werror bm.c Stack.o : Stack.c Stack.h gcc -c -Wall -Werror Stack.c
There are three components: target, source and action.
: is the target, after it is the source, and below it is the action.
make is smart as it compares the modification timestamp of sources to decide what actions to do (if it is newly modified).
Memory regions during C program execution
Memory allows you to load bit-strings of sizes 1,2,4,8 bytes from N-byte boundary addresses into registers in the CPU. Data representation is to give these bytes meanings.
Character Data is about encodings of characters.
Numeric data comes in two major forms: integer and floating point numbers
single vs double
IEEE 754 Standard for Floating-Point Arithmetic
Double is more precise than single and occupies more memory.
For week 2’s lab, we are to create a
struct for big number and write a big number adder. One of the challenge task and one of the most interesting task is to make the
struct more compact. At first, we used
unsigned char to represent a digit, and I was thinking of to use a data type that occupies only 4 bits (enough to represent 1 - 16). But after searching around, I found that
unsigned char or
uinit8_t is the smallest data types in C, which only occupies 1 byte, which is atomic.