082267_lesson4

082267_lesson4 - CS 367 Programming Languages Lesson 4...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 367 Programming Languages Lesson 4 Problem Set Questions Chapter 7 1. When might you want the compiler to ignore type differences in an expression? Compilers should ignore type differences when you are overloading the operators (allowing for multiple uses of an operator) since this can sometimes cause problems with readability and reliability. 7. Describe a situation in which the add operator in a programming language would not be commutative. The operands of addition are memory locations and the results are stored in the same location as one of the operands, so the operation cannot be commutative. X+Y may not give the same result as Y+X because of the storage location of the result. 13. What are the values of sum1 and sum 2 a. if the operands in the expression are evaluated left to right and b. if the operands in the expression are evaluated right to left? If evaluated from left to right sum1 would equal 46 and sum2 would equal 48. If evaluated from right to left, sum1 would equal 48 and sum2 would equal 46. The end result is exact opposite for each variable
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/19/2011 for the course CS 367 taught by Professor Unkown during the Spring '09 term at Grantham.

Page1 / 2

082267_lesson4 - CS 367 Programming Languages Lesson 4...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online