This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
'restrict': C9X vs C99
- To: gcc at gcc dot gnu dot org
- Subject: 'restrict': C9X vs C99
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Tue, 25 Jul 2000 01:36:57 +0100 (BST)
When 'restrict' was implemented in GCC, the public C9X drafts gave it
'unique access' semantics: the only access to an object accessed through a
restricted pointer was through that pointer. In C99 this changed to 'one
writer or many readers': if an object is accessed through a restricted
pointer and is also somehow modified then all access is through that
pointer, but unmodified objects may be aliased.
Which semantics are currently implemented in GCC, and does it make any
difference? (In particular, is code written to the C99 semantics safe
with GCC?) I would guess that aliasing of read-only objects shouldn't
cause problems as long as alias information doesn't escape from the scope
of the restricted pointer, but perhaps an alias analysis expert could
comment?
--
Joseph S. Myers
jsm28@cam.ac.uk