Friendly-C

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 29 10:29:49 PDT 2014


On Friday, 29 August 2014 at 08:50:59 UTC, Ola Fosheim Grøstad
wrote:
> On Friday, 29 August 2014 at 08:29:50 UTC, deadalnix wrote:
>> Because, if you don't have undefined BEHAVIOR, you can't 
>> change the BEHAVIOR. So you have to prove that store/loads 
>> won't fault before doing anything with them. As per spec. Or 
>> you'll change the BEHAVIOR.
>
> By fault you mean trap an illegal address. I don't think that 
> should be required unless it is volatile, but that would depend 
> on the spec.
>
> "Undefined behaviour" goes much further and can in theory 
> propagate all over the program…

Not only illegal address. You can trap for various reason, for
instance GC read/write barrier.

Indeed, undefined behavior can be anything, by definition, and 
this cannot. Still, removing undefined behavior and replace it by 
undefined values cause the optimizer to have to prove that 
load/store won't fault, which is going to kill any expectation of 
performance.


More information about the Digitalmars-d mailing list