Homework Assignment 7
CS 316, Spring 2003
Due on Thursday, April 11, 2003

This assignment has four problems from pages 312-314 at the end of Chapter 6 of our textbook, Programming Language Pragmatics.

1.) Do Exercise 6.3 (using Scheme instead of Lisp).

2.) This is a modification of Exercise 6.4. Investigate the order of evaluation of function parameters using the C language and the lcc, gcc, and Visual Studio compilers. Are parameters evaluated left-to-right or right-to-left? One of these three compliers is different than the other two; which one is it? Use a suitable C program and assembly language listings from each of these compilers to demonstrate your results. In addition, write a small program in which the order of parameter evaluation makes a difference in the results of the computation.

3.) Do Exercise 6.10. Write your answers in terms of C's ternary conditional expression. That is, show how to use the ternary conditional expression to implement the short-circuited boolean operators && and ||.

4.) This is a modification of Exercise 6.16. Rewrite the piece of code in C without using a goto statement. In your opinion, which is a better piece of code, your example without the goto statement, or the example in the exercise with the goto statement. Give a justification for your opinion.


Return to the main homework page.
Return to the CS 316 home page.


compliments and criticisms