this is null
spir
denis.spir at gmail.com
Sun Mar 10 14:25:56 UTC 2019
On 09/03/2019 21:10, ANtlord via Digitalmars-d-learn wrote:
> On Saturday, 9 March 2019 at 20:04:53 UTC, Paul Backus wrote:
>>
>> You can end up with a null `this` reference if you dereference a null pointer
>> to a struct and then call a method on the result. For example:
>>
>
> I can but my reference is not null before calling. Take a look at the line of
> code [0]. There is a check before the line.
>
> https://github.com/ANtlord/deadmemory/blob/master/src/deadmemory/mem.d#L20 [0]
There is a typo in this instruction:
T* ptr = this.list.getFisrtFreeOrAdd(memViewLen).getPtr!T();
^^
rs
(may this explain your null? the compiler should complain)
diniz
More information about the Digitalmars-d-learn
mailing list