Friendly-C

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 29 12:37:27 PDT 2014


On Friday, 29 August 2014 at 18:46:20 UTC, Marc Schütz wrote:
> On Friday, 29 August 2014 at 17:46:31 UTC, Ola Fosheim Grøstad 
> wrote:
>> On Friday, 29 August 2014 at 17:34:42 UTC, deadalnix wrote:
>>> No, as the load or the store involved can fault/trap.
>>
>> What kind of trap? Not getting an exception will not 
>> necessarily change correctness.
>
> It does. An access that can potentially fault is more or less 
> equivalent to this:
>
>     if(p is null)
>         throw new Error();
>     *p = ...;
>
> When you remove the access, you're removing the test, which 
> changes program semantics.

NULL or any address, as you can change memory protection on a per
page basis, and have different protection for read write and
execution.

Even better, the fault do not have to result in an exception or
other form of termination. in fact, it is demonstrated that the
fault mechanism on x86 is Turing complete.


More information about the Digitalmars-d mailing list