M
Mike Pennington
Recently we came upon the following construct in some code from a system
that we were rehosting:
index = index++;
The intent of the programmer was to increment the index by 1. On the
old system this worked as desired.
On the new system, with a different compiler, the value of index was
never changed. I know that the way
that it should have been coded was either
index++;
or
index += 1;
My question is whether anyone knows if there is a defined interpretation
of the statement as originally
written and if so what is it?
Thanks
that we were rehosting:
index = index++;
The intent of the programmer was to increment the index by 1. On the
old system this worked as desired.
On the new system, with a different compiler, the value of index was
never changed. I know that the way
that it should have been coded was either
index++;
or
index += 1;
My question is whether anyone knows if there is a defined interpretation
of the statement as originally
written and if so what is it?
Thanks