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

On 2010-12-17, BartC <bc@xxxxxxxxxx> wrote:
"Seebs" <usenet-nospam@xxxxxxxxx> wrote in message
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.

Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam@xxxxxxxxx <-- lawsuits, religion, and funny pictures <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.