Re: A basic (?) problem with addresses (gcc)



On 2010-12-17, BartC <bc@xxxxxxxxxx> wrote:
"Seebs" <usenet-nospam@xxxxxxxxx> wrote in message
news:slrnigngqu.a6p.usenet-nospam@xxxxxxxxxxxxxxxxxx
On 2010-12-17, BartC <bc@xxxxxxxxxx> wrote:
I'm just
suggesting something less cumbersome and restrictive than unions.

It sounds very cumbersome and restrictive from the standpoint of an
implementor trying to decide whether to generate extremely slow memory
reads from an object that in theory shouldn't be getting modified.

This is the original code:

I was talking about your more generic equivalence with arbitrary
overlap but...

If it has been written to (initialising y to 0 would have been better), then
how did that rogue value get there? What were they trying to optimise?

The general case is this:

int foo(int *a, float *b) {
float x = *b;
*a = 3;
x = *b;
}

Can the second read from *b be optimized away? In C, yes. In your
hypothesized language, no.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam@xxxxxxxxx
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.
.



Relevant Pages

  • Re: Challenge: optimizing isqrt
    ... This returns the integer part of the square root of n, that is, the greatest ... long int too large to convert to float ... the challenge is to identify when it is safe to optimise isqrtas ...
    (comp.lang.python)
  • Challenge: optimizing isqrt
    ... There is an algorithm for calculating the integer square root of any ... This returns the integer part of the square root of n, that is, the greatest ... long int too large to convert to float ... the challenge is to identify when it is safe to optimise isqrtas ...
    (comp.lang.python)
  • Re: When are release versions SLOWER !?
    ... little code to optimise. ... I'm sure I could improve the float version, my only concern is the huge release vs debug execution time. ... Phil Frisbie, Jr. ...
    (microsoft.public.vc.language)