How does D cope with aliasing

#ponce aliloko at gmail.com
Wed Sep 9 17:06:24 PDT 2009


> 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 
> about this is that you still can use array slices and the .length field, 
> so the code most likely is less messy than the C version would be.

Interesting tip, thanks !


More information about the Digitalmars-d-learn mailing list