Homework 1

Computer Architecture I ShanghaiTech University
HW1 HW2

Task 1: Doubly linked list 70%

Implement a doubly linked list in C. See the header file doubll.h for specifics. Implement the code in a file called "doubll.c".
In the gradebot repo put your file "doubll.c" in a folder called "task1". Gradebot will automatically use "doubll.h" and a Makefile in that same folder.
When a function is provided with a pointer to an item by default it is not checked if that item belongs in fact to that list. Only if provided with a precompiler define called "CHECK_LIST" the program should do the (expensive) search if item is in that list.
Note that all C programs of this homework use the C standard C89. Also no warnings are allowed. Compilation is done using:
gcc -Wpedantic -Wall -Wextra -Werror -std=c89
Also, in doubll.c at least every 4th line has to be a comment! The comments have to be in English and meaningful (will be checked by hand by the TAs).
Furthermore, your doubll.c may not have more than 250 non-blank lines (Don't worry - this is plenty).
New Notes Feb 28:

Task 2: Libraries

All work is done in the folder "task2". Assume that there is a file called test.c with a main function in it. The doubll.h will be copied (by the gradebot) to the folder task2 and also your file doubll.c will be copied here from Task 1.

Task 2.1: Static library 15%

Write a script called test_static.sh that, in the first step, compiles a static link library from the files of Task 1 (use the command "ar"). In the second step the script should compile the program test.c as an object file. In the third step link that object file with your static library to create an executable called "static_test" (use the command "ld").

Task 2.2: Dynamic link library 15%

Write a script called test_dynamic.sh that, in the first step, compiles a dynamic link library from the files of Task 1. In the second step the script should compile the program test.c as output "dynamic_test" using the dynamic link library. Be sure to set the rpath correctly to the folder ".". The library has to be called "libdoubll.so".

Notes