What's the D equivalence?

Imperatorn johan_forsberg_86 at hotmail.com
Fri Mar 5 15:48:27 UTC 2021


On Friday, 5 March 2021 at 15:22:51 UTC, Paul Backus wrote:
> On Friday, 5 March 2021 at 15:17:29 UTC, Imperatorn wrote:
>> On Friday, 5 March 2021 at 13:09:26 UTC, Jacob Carlborg wrote:
>>> On Friday, 5 March 2021 at 10:13:32 UTC, Imperatorn wrote:
>>>> [...]
>>>
>>> One thing that is missing in D is runtime error on 
>>> dereferencing a null pointer. D relies on the platform to 
>>> trigger a segmentation fault. Of course, there are some 
>>> platforms that don't do that.
>>>
>>> --
>>> /Jacob Carlborg
>>
>> Ok, that's fine though imo.
>
> It's actually a bit problematic because @safe relies on the 
> fact that dereferencing a null pointer has defined behavior 
> (i.e., it crashes the program). On platforms that don't 
> guarantee this, D currently allows undefined behavior in @safe 
> code.

Yeah, what I meant was, I'm so used to null-checking so it's not 
a big deal for me.


More information about the Digitalmars-d mailing list