Search code examples
coperatorsincrementtest-and-set

History of the ++/-- Operators as compared to the test-and-set instruction/operation


I am taking CS420 - Operating Systems. My professor mentioned something in class the other day that peaked my interest and I have been researching it and have gotten close but cannot find out the answer.

He mentioned that him and another professor had wondered in the past if the creation of the ++/-- operators was originally intended to bind the ++/-- operators to the test-and-set operation/instruction.

He said that they weren't able to figure it out. I didn't ask him how much effort they had invested in this but would be very interested in the communities input.


Solution

  • C is a platform independent language and designed as such. It was designed to compile against various machine languages and architectures, so it's difficult imagine they were counting on a test-and-set instruction or any CPU family-specific instruction in particular.