Introduction
Design Issues
Forms
Precedence
Operators
Notations
Evaluation
Side Effects
Overloading
Functional Side Effects

Functional side effects is when a function changes a two-way variable or nonlocal variable.

Problem:
When a function referenced in an expression alters another operand of the expression.
  • x = 10;
  • y = x + function(&x);
Two possible solutions:
Solution 1
  • Write the language definition to disallow functional side effects.
  • No two-way parameters and nonlocal references in functions.
  • Disadvantage: Programmer want the flexibility of two-way parameter and nonlocal references.
Solution 2
  • Write the language definition such that the operand evaluation order is fixed.
  • Disadvantages: Certain compiler optimization may be limited.

Arithmetic Expressions SCLM - CS 561 - Team 1