Disallow null references in safe code?

Meta jared771 at gmail.com
Mon Feb 3 17:09:51 PST 2014


On Monday, 3 February 2014 at 23:34:59 UTC, deadalnix wrote:
> On Monday, 3 February 2014 at 22:23:52 UTC, Meta wrote:
>> If null is an invalid value to assign to a pointer, then 
>> there's no issue.
>>
>> int* foo()
>> {
>>    //Error: cannot implicitly convert typeof(null) to type int*
>>    return "/etc/foo".exists ? new int : null;
>> }
>
> Only cross abstraction boundaries is sufficient.

Can you explain?


More information about the Digitalmars-d mailing list