How does D cope with aliasing

Stewart Gordon smjg_1998 at yahoo.com
Sat Sep 5 15:43:33 PDT 2009


#ponce wrote:
> I'm currently using a lot of pointers to perform heavy computation
> 
> Has D the equivalent for C's restrict ? More generally, how does D 
> cope with the aliasing of pointers ? I think it's crucial for the 
> code optimizer.

My recollection of reading the spec is that a D compiler is allowed to 
optimise by assuming no pointer aliasing.  But I can't remember at the 
moment where I read this.

But in the absence of this, you can use contracts to guard against at 
least the simplest forms of aliasing.

Stewart.


More information about the Digitalmars-d-learn mailing list