Re: How does D cope with aliasing

2009-09-09 Thread #ponce
> If you always want DMD never to bounds check for specific code, you just > can write "a.ptr[index]" instead of "a[index]" (when a is an array). > That's because array.ptr returns a pointer to the first element, and > using [] on a pointer works exactly like C pointer math. The good thing > ab

Re: How does D cope with aliasing

2009-09-09 Thread grauzone
#ponce wrote: Stewart Gordon Wrote: 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. I don't know if this is neat or nasty for a compiler to do so. OT : Is there a DMD swi

Re: How does D cope with aliasing

2009-09-07 Thread Stewart Gordon
#ponce wrote: OT : Is there a DMD switch to disable bound check exceptions ? This way I wouldn't have to rely on pointers so much. Why do you want to do that? Sounds like a case of trying to fix the wrong problem. Stewart.

Re: How does D cope with aliasing

2009-09-07 Thread Lars T. Kyllingstad
#ponce wrote: Stewart Gordon Wrote: 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. I don't know if this is neat or nasty for a compiler to do so. OT : Is there a DMD swi

Re: How does D cope with aliasing

2009-09-07 Thread #ponce
Stewart Gordon Wrote: > 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. I don't know if this is neat or nasty for a compiler to do so. OT : Is there a DMD switch to disab

Re: How does D cope with aliasing

2009-09-07 Thread #ponce
#ponce Wrote: > Stewart Gordon Wrote: > > 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. > > I don't know if this is neat or nasty for a compiler to do so. > > OT :

Re: How does D cope with aliasing

2009-09-05 Thread Stewart Gordon
#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 al

Re: How does D cope with aliasing

2009-09-05 Thread bearophile
#ponce: > 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.< DMD probably just doesn't perform such optimizations. LLVM that'

Re: How does D cope with aliasing

2009-09-05 Thread Jarrett Billingsley
On Sat, Sep 5, 2009 at 3:49 AM, #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. It doesn't.