3 ms·
what happened to: c=-1; ambiguously being either: c = -1; // c becomes -1 or c =- 1; // c decremented by 1
by m463 4y ago
what happened to:
c=-1;
ambiguously being either:
c = -1; // c becomes -1
or
c =- 1; // c decremented by 1
- dale_glass 4y agoWas never a thing? It's: c -= 1; // c decremented by 1 Notice the order is different.
- m463 4y agosorry, it was a longer time ago than I realized: Compound assignment operators of the form =op (such as =-) were changed to the form op= (that is, -=) to remove the semantic ambiguity created by constructs such as i=-10, which had been interpreted as i =- 10 (decrement i by 10) instead of the possibly intended i = -10 (let i be −10). https://en.wikipedia.org/wiki/C_(programming_language)#K&R_C https://en.wikipedia.org/wiki/C_(programming_language)#K&R_C
- taylodl 4y agoYeah - it goes back prior to 1978!