HW4_Key - Chapter 7: (Problem Set: Pages 306 308) 3) Do you...

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

View Full Document Right Arrow Icon
١ Chapter 7: (Problem Set: Pages 306 – 308) 3) Do you think the elimination of overloaded operators in your favorite language would be beneficial? Why or why not? Answer: - Yes, I think that the elimination of overloaded operators in my favorite language would be beneficial. - Elimination of overloaded operators will result in: - Enhance and increase readability. - Minimize the compiler overhead (choosing the correct operator meaning). 4) Would it be a good idea to eliminate all operator precedence rules and require parentheses to show the desired precedence in expressions? Why or why not? Answer: - No, it is not a good idea to eliminate all operator precedence rules. - Although this idea sounds good, but in fact it affects the flexibility provided by the language since only one way is used to show the precedence in expressions. Moreover, using parentheses will future more affects writability and in some cases readability. 10) Assume the following rules of associativity and precedence for expressions: Precedence: Highest *, /, not +, -, &, mod - (unary) =, /=, <, <=, >=, > and Lowest or , xor Associativity: Left to right Show the order of evaluation of the following expressions by parenthesizing all subexpressions and placing a superscript on the right parenthesis to indicate order. For example, for the expression: a + b * c + d the order of evaluation would be represented as ((a + (b * c) 1)2 + d) 3 Expression evaluated Order of evaluation a. a * b - 1 + c Æ ( ( ( a * b ) 1 – 1 ) 2 + c ) 3 b. a * (b -1) / c mod d Æ ( ( ( a * ( b – 1 ) 1 ) 2 / c ) 3 mod d )
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.

Page1 / 5

HW4_Key - Chapter 7: (Problem Set: Pages 306 308) 3) Do you...

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