restrict in practice

Don nospam at nospam.com
Sun Jan 3 10:39:25 PST 2010


bearophile wrote:
> This is a paper by Markus Mock is about the usefulness of the "restrict" annotation in medium-sized C programs:
> http://www.cs.pitt.edu/~mock/papers/clei2004.pdf
> 
> The author finds that restrict is not significantly useful in the bulk of programs, while it can be useful in computational kernels (small routines that perform heavy array operations).

[snip]

> So it can be useful to have ways for the D compiler to know what pointers in a computational kernel aren't alias of each other, but I'd like this to be safer, unlike C. 

Unique & lend for class references may be usable for pointers too.

I think we're actually in good shape here.
Note that D's array operations cover some of the simplest (but most 
important) use cases. When dealing with a D array, the compiler has a 
_lot_ more information than with a pointer.



More information about the Digitalmars-d mailing list