What are '++' and '---; used for in Chapel

I was just looking at 'chpl.lex' and was curious.

Thx.

Hi Damian —

I'm fairly certain that they're primarily there to help generate errors saying that they're not interpreted as in C/C++ since, without that,

y = --x;
z = ++x;

could be interpreted as:

y = -(-x);  // equivalent to y = x;
z = +(+x);  // equivalent to z = x;

which would have a very different meaning.

-Brad

1 Like