Safe method wont check dangling pointer?

Steven Schveighoffer schveiguy at yahoo.com
Mon Apr 14 18:33:22 PDT 2014


On Mon, 14 Apr 2014 21:10:57 -0400, lzzll <ownrepos at gmail.com> wrote:

> Let me ask:
> 1. That's mean if I write a safe library and another guy use it in the  
> wrong way, it still not really safe, right?

Garbage in, garbage out. The safe function must have reasonable  
expectations, and it's up to you to meet them. Is it "mean"? I don't think  
so. I think you have to adjust what you think @safe means.

> 2. In the real world use, if I received a segmentation fault that mean I  
> had to get the core dump and trace where is the problem, that's all  
> right. But if I not received anything but actually the bad memory has  
> been write or leak, that's the security issue.

If it's for a null pointer, you will not have a memory corruption.

> 3. I hope it will be truly safe in the future, prevent the access to  
> dangling pointer, is there any plan or idea for this?

This is actually impossible to implement.

-Steve


More information about the Digitalmars-d mailing list