vault backup: 2024-11-10 21:31:06

This commit is contained in:
zleyyij 2024-11-10 21:31:06 -07:00
parent a720c5d1f7
commit a722cdd3b7

View File

@ -1,6 +1,11 @@
> **1.** Section 15.1 listed several advantages of dividing a program into multiple source files.(a). Describe several other advantages > **1.** Section 15.1 listed several advantages of dividing a program into multiple source files.(a). Describe several other advantages
- Easier to scale horizontally as developers are added to the team
- Reduced cognitive load from less global scope to keep track of
> (b). Describe some disadvantages > (b). Describe some disadvantages
- Increased complexity
- Need to maintain/troubleshoot a build system
--- ---
@ -44,7 +49,11 @@ Macro invocations are evaluated sequentially, and so if `DEBUG` was defined afte
--- ---
> **5.** Suppose that a program consists of three source files - `main.c`, `f1.c`, and `f2.c`- Plus two header files, `f1.h` and `f2.h`. All three source files include `f1.h` but only `f1.c` and `f2.c` include `f2.h`. Write a makefile for this program, assuming that the compiler is `gcc` and that the executable file is to be named `demo`. > **5.** Suppose that a program consists of three source files - `main.c`, `f1.c`, and `f2.c`- Plus two header files, `f1.h` and `f2.h`. All three source files include `f1.h` but only `f1.c` and `f2.c` include `f2.h`. Write a makefile for this program, assuming that the compiler is `gcc` and that the executable file is to be named `demo`.
```makefile
demo: main.o f1.o f2.o
```
--- ---
> **6.** The following questions refer to the program described in Exercise 5. > **6.** The following questions refer to the program described in Exercise 5.
@ -55,3 +64,4 @@ Macro invocations are evaluated sequentially, and so if `DEBUG` was defined afte
> (c). If `f1.h` is changed after the program has been built, which files need to be recompiled? > (c). If `f1.h` is changed after the program has been built, which files need to be recompiled?
> (d). If `f2.h` is changed after the program has been built, which files need to be recompiled? > (d). If `f2.h` is changed after the program has been built, which files need to be recompiled?