Friendly-C

Ola Fosheim Gr via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 28 22:55:17 PDT 2014


On Friday, 29 August 2014 at 05:31:02 UTC, deadalnix wrote:
> If the value in unspecified, rather than the behavior 
> undefined, it means that no load or store can be optimized away 
> or reordered, unless the compiler can prove that is won't fault.
>
> I'm talking about doubtful optimization to gain 0.5% here, but 
> that everything single variable except locals must be 
> considered volatile in the C sense.

Why is that? If the value is unspecified then you can assume a 
random value, so no single store is needed unless explicitly 
volatile?

Wrapping semantics is also bad for optimization, though. You 
cannot reduce length < length+N to true in generic code, so you 
need to establish bounds on x or create multiple execution paths. 
This is usually silly when using a 64 bit int...


More information about the Digitalmars-d mailing list