This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: question on semantics
- From: Mike Stump <mrs at apple dot com>
- To: Chris Friesen <cfriesen at nortelnetworks dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 4 May 2005 12:19:18 -0700
- Subject: Re: question on semantics
- References: <42790D95.2060004@nortelnetworks.com>
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.