manual memory management

Paulo Pinto pjmlp at progtools.org
Thu Jan 10 00:35:20 PST 2013


On Thursday, 10 January 2013 at 00:50:30 UTC, Adam D. Ruppe wrote:
> On Thursday, 10 January 2013 at 00:18:26 UTC, Walter Bright 
> wrote:
>> And that is not dereferencing null, it is dereferencing 
>> 0x1000000.
>
> Yes, but it is worth noting that dmd will happily compile that 
> code, even if marked @safe - just because the pointer on the 
> language level is null doesn't mean it is memory safe at the 
> assembly level.
>
> the generated code with @safe is still just what we'd expect 
> too:
>    3:   31 c0                   xor    eax,eax
>    5:   c7 80 00 00 10 00 0a    mov    DWORD PTR 
> [eax+0x100000],0xa

That brings us to another point.

It does not matter how safe a language might be, if someone can 
change the assembly then everything is possible.

Or am I going too off-topic?


More information about the Digitalmars-d mailing list