question on semantics

Mike Stump mrs@apple.com
Wed May 4 19:21:00 GMT 2005


On May 4, 2005, at 10:59 AM, Chris Friesen wrote:
> I'm not sure who I should address this to...I hope this is correct.
>
> If I share memory between two processes, and protect access to the  
> memory using standard locking (fcntl(), for instance), do I need to  
> specify that the memory is volatile?

It is safer to.  People might compile your whole app at once for  
better optimization, and the compiler might be just smart enough to  
optimize it away.  This would be in conjunction with the compiler  
getting smarter about libc style functions, and what they read and  
write.  Both of these can happen in the next 5 years in my book.   
Betting on the optimizer not getting smart, is a dangerous bet,  
better to just state what you want to do.



More information about the Gcc mailing list