






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







1
Today’s Agenda
Control Flow Mechanisms
(Chap. 6)
Sequencing
Costs and Issues
Example
Costs and Issues (cont.)
Costs and Issues (cont.)
Implementing Strategy 3
(generating error messages)
When every execution path preceding the use of a variable fails to contain a definition (this is ok, but it’s seldom this simple) When some execution path preceding the use of a variable fails to contain a definition Java does this It’s quite restrictive – may give an error when no problem will actually occur in practice
Generate errors in the easy (every path) case Generate warnings in the second case (Optionally) Employ run-time detection of variable usage errors This is extremely expensive and seldom practiced for compiled languages Typically requires using an extra-bit flag
Basic Concepts
Expression Evaluation
Expression Evaluation
Efficiency Improvement:
Example
a = b + c; d = c + e + b;
a = b + c; d = a + e; Moral: Programmer not typically allowed to make any assumption about the order of subexpression computation in c
Exception to this Rule: Short
Circuiting