C `restrict` keyword in D

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 4 02:47:12 PDT 2017


On Monday, 4 September 2017 at 09:15:30 UTC, ag0aep6g wrote:
> On 09/04/2017 06:10 AM, Moritz Maxeiner wrote:
>> Indeed, but it also means that - other than null dereferencing 
>> - pointer issues can by made into reference issues my 
>> dereferencing a pointer and passing that into a function that 
>> takes that parameter by reference.
>
> Why "other than null dereferencing"? You can dereference a null 
> pointer and pass it in a ref parameter. That doesn't crash at 
> the call site, but only when the callee accesses the parameter:
>
> [...]

Because I was ignorant and apparently wrong, thanks for the 
correction.
Still, though, this is surprising to me, because this means 
taking the address of a parameter passed by reference (which is 
in your case is typed as an existing int) can be null. Is this 
documented somewhere (couldn't find it in the spec and it seems 
like a bug to me)?


More information about the Digitalmars-d mailing list