Index: [thread] [date] [subject] [author]
  From: Robert C. Duvall <rcd@cs.duke.edu>
  To  : 
  Date: 01 Feb 1999 13:09:44 -0500

Re: ++ and -- operators

> I have a question about the ++ and -- operators; in C++, these
> add/subtract 1 from a variable, and store that new value in the
> variable.  However, in the examples on pg. 2 of the assignment,
> the example for ++ says "++(a + b * c)".  Obviously, this example
> shows ++ working on an expression rather than a single variable,
> and so storing a new value would be impossible.  So, should we
> implement ++ and -- so that they just add/subtract 1 from any
> expression, or should we have them add/subtract 1 from a variable
> and store the result as the new value of the variable?

The arithmetic interpreter you are writing does not necessarily need
to conform to the limitations of C++ expressions.  In other words, in
your cool program, you can add/subtract one from an expression.

rcd


-- 
Robert C. Duvall
Lecturer, Duke University
rcd@cs.duke.edu


Index: [thread] [date] [subject] [author]