illinois-cs241 / coursebook

Open Source Introductory Systems Programming Textbook for the University of Illinois
http://cs241.cs.illinois.edu/coursebook
666 stars 80 forks source link

cast void* to int* before modifying in Race Condition. Resolves #170 #171

Closed RidhwaanDev closed 4 years ago

RidhwaanDev commented 4 years ago

In order to access and modify the underlying int value of a void we must first cast to int. Then we use the int* to modify the value. Without this cast running gcc file.c throws an error. Resolves issue #170

aneeshdurg commented 4 years ago

NVM, I misread what the assembly was doing, both are close enough. I'd still prefer if there was only 1 dereference in the code for reading the pointer to keep things simple though.

bhuvy2 commented 4 years ago

Awesome thanks @RidhwaanDev!