Computer Programming Languages -- Expressions and Assignment Statements

By Herbert J. Bernstein

© Copyright 2000 Herbert J. Bernstein

Imperative programming languages make use of expressions and assignment statements to convey sequential steps of a calculation. The notation used is very much like that for algebraic equations, but, unlike an algrebraic equations which make logical assertions relating the components of the equation, programming language expressions and assignment statements describe actions to be performed, so that the same symbols may have different meaning at different places in the same statement, and the same statement may have different meanings depending on what has happened previously to the state of the machine.

- Expressions -- combinations of operators and operands
- Operators
- Prefix, infix, postfix
- Unary, binary, ternary, ...
- Operators without operands
- Commutative, non-commutative
- Associative, non-associative
- Operator notations
- Arithmetic operators
- Relational operators
- Logical operators
- Matrix operators
- Functional notation
- User defined operators

- Operands -- variables, constants, expressions
- Values (r-values) vs. addresses (l-values)

- Assignment statements
- Operation vs. expression
- Multiple assignment
- C, C++, Java compound assigment operators
- Immediate execution vs. lazy evaluation
- Symbolic vs. numeric

- Order of operand evaluation
- Order of operator application
- Type conversions
- Explicit conversions
- Implicit coercions
- Loss of accuracy
- Unintended conversions and unintended dereferencing
- Mixed mode expressions

Last Updated on 25 March 2000

By Herbert J. Bernstein