Passing an in parameter and aliasing

Oskar Linde oskar.lindeREM at OVEgmail.com
Sat May 26 01:52:14 PDT 2007


Bill Baxter skrev:
> Dave wrote:
>> [restrict]
> That's C's philosophy anyway.  And I haven't heard anything from Walter 
> that sounded to me like D was taking a different approach.  I think a 
> 'restrict' type keyword probably is the best way to handle it in a 
> C-like language.  Most code doesn't need the performance boost as much 
> as it needs predictability and reliability.  Aliasing bugs can also be 
> very tricky to debug because things might work great on your computer 
> but only fail on some other machine when compiled with SSE3 instructions 
> and -03 optimizations.  So it makes sense for performance critical code 
> to declare in a visible way that it's placing some restrictions on the 
> kind of inputs that will work.
> 
> So I think D could still use a separate restrict-like keyword.  But I 
> think it could be made a little more user friendly than C's by allowing 
> it to apply to a whole function rather than having to say 'restrict' 
> 'restrict' 'restrict' for every single parameter.

Here is an old thread about "noalias, restrict, and Fortran optimizations":

http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=D&artnum=28215&header

/Oskar



More information about the Digitalmars-d mailing list