l4-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Contribution to the Hurd on L4


From: Ludovic Courtès
Subject: Re: Contribution to the Hurd on L4
Date: Fri, 7 Jan 2005 10:17:07 +0100
User-agent: Mutt/1.5.3i

Hi,

On Thu, Jan 06, 2005 at 10:46:04PM +0100, Marcus Brinkmann wrote:
> Ok, the actual rules are complicated, but the basic rule is that two
> pointers to different types never ever point to overlapping memory
> regions.  This means that you can't cast pointers to other types and
> expect them to work.  The compiler can just optimize away derefences
> to pointers which have the value of a different type.  An exception is
> char*, which can always be used (otherwise memcpy and friends would
> not do what you expect).

My understanding of the standard [1] (section 6.7.3.1) is that what you
describes holds _only_ for `restrict'-qualified pointers, not for any
pointer (otherwise most C programs would break when compiled with a C99
compiler).  The pointers used in the examples you gave did not have this
qualifier.

Ludovic.

[1] Fortunately, someone had the good idea to keep a copy of the
    standard on the web: http://www.nirvani.net/docs/ansi_c.pdf .  ;-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]