Homework #1 Solution

$30.00

Description

Do homework problems 2.64, 2.72, 2.73, and 2.82 from Bryant & O’Hallaron 3rd edition. If using 2nd edition, do problem 2.81 instead of 2.82.

In addition, redo problem 2.73, this time using a call to

the __builtin_add_overflow function available in GCC 5 and later; the third argument of the call should consist of the unary address-of operator ‘&’ applied to a local variable. In other respects your function should continue to follow the bit-level integer coding rules.

Submit your homework answers as a gzipped tarball containing your answers to each problem, in the files hw1/2.64.c, hw1/2.72.txt, hw1/2.73.c, hw1/2.82.txt,

and hw1/2.73-redo.c respectively. The .txt files should be plain ASCII text files with lines terminated by LF. The .c files should compile cleanly with shell commands like this:

gcc -O2 -Wall -Wextra -S hw1/2.73.c

As we will grade your submission with the latest version of GCC installed in /usr/ local/cs/bin/ on the newer SEASnet GNU/Linux servers, it would be wise to check your work on that platform. On this platform the shell command ‘gcc –version’ should output ‘gcc (GCC) 6.2.0’ or later.

To create your tarball, use the shell command:

tar -cf – hw1/2.64.c hw1/2.72.txt hw1/2.73.c hw1/2.82.txt hw1/2.73-redo.c | gzip -9 >hw1.tar.gz

© 2016 Paul Eggert. See copying rules.

$Id: hw1.html,v 1.1 2016/09/20 17F30F13 eggert Exp $