Trusting clang

In 1983, Ken Thompson won the Turing Award, "the Nobel Prize of computing" named after Alan Turing. In accepting the award, Thompson presented "the cutest program [he] ever wrote," the moral of which was that you "can’t trust code that you did not totally create yourself."

Read Reflections on Trusting Trust. Note that the boldfaced captions for Figure 2.1 and Figure 2.2 are incorrect: when Thompson refers to Figure 2.1, he means the topmost figure in the righthand column of page 762; when Thompson refers to Figure 2.2, he means the middle figure in the righthand column of page 762; when Thompson refers to Figure 2.3, he means the bottommost figure in the righthand column of page 762. Also note, per asciichart.com, that the ASCII code for a "vertical tab" (aka VT) is 11 in decimal.

Answer the below in trust.txt.

Questions

  1. (2 points.) Suppose that you wish to alter the C compiler to include the sequence \N to represent the new line character so that programmers can print new lines, as via printf, either with \n or \N. What line of code could you add or change in Figure 2.3 in order to support \N?

  2. (4 points.) Even though clang is open-source (which means that its source code is publicly available), why should you still not trust it, given that you could inspect its code for Trojan horses? And why should you not trust clang even if you compiled it yourself?

Debrief

  1. Which resources, if any, did you find helpful in answering this problem’s questions?

  2. About how long did you spend on this problem’s questions?