Closed clalancette closed 6 years ago
Should we merge this as-is or use volatile
?
Should we merge this as-is or use volatile?
In my testing, putting a volatile
on the stack variable some_memory
didn't make any difference. That said, adding it to side_effect
probably won't hurt anything. I'll try it out and then post an update here.
I added volatile in cbd40227aabb1a75a427a64906dfece7a03e0adf, and it seems to work:
https://ci.ros2.org/job/ci_osx/4058
It's slightly ugly in that I have to cast the volatile void *
to void *
for the memcpy, but it's not a huge deal. Like I said, volatile didn't make a different in my testing anyway, so I'm fine going either way; just let me know.
I'm fine with or without as well, @sloretz any opinion?
I approved without volatile; I'm just as happy to approve with it.
Sounds like leave it as-is (with volatile in). Does it need new CI or are we good to go?
Sounds like leave it as-is (with volatile in). Does it need new CI or are we good to go?
I'll do a quick CI; it only takes like 10 minutes. Assuming that is clean, I'll go ahead and merge.
Thanks @clalancette and @sloretz!
To truly keep away the optimizer, we make sure that my_first_function has an externally-visible side-effect.
Signed-off-by: Chris Lalancette clalancette@openrobotics.org