Friendly-C

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 28 22:31:00 PDT 2014


On Friday, 29 August 2014 at 02:10:55 UTC, ketmar via 
Digitalmars-d wrote:
> On Thu, 28 Aug 2014 09:12:15 +0000
> deadalnix via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
>
>> It forces all the load to potentially have side effects, 
>> which, in turn, limit dramatically what the optimizer can do.
> but there is alot code that doesn't need "super-speed". it's ok 
> to
> fallback to "standard C" for the parts that need all speed we 
> can have
> w/o assembly. but most programs are ok with not-so-extensive
> optimizations, and writing code in "friendly c" is much easier 
> than in
> "standard c".
>
> i myself compiling all my C code with -fwrapv 
> -fno-strict-aliasing
> -fno-delete-null-pointer-checks. i believe that compiler was 
> made to
> make my life easier, not to make it harder. so it's the 
> compiler who
> should obey my orders, not vice versa. ;-)

It is not only about null checks.

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.


More information about the Digitalmars-d mailing list