On Wed, Apr 18, 2001 at 06:18:13PM -0400, Uncle George wrote:
> Its not my code segment, and from my experience a union might be better.
> although from this discourse not safe either.
>
> the code as stated should:
> 1) take address of x
> 2) make into int ptr
> 3) add 1 to ptr ( value of 4 bec its an int ptr )
> 4) fetch integer from the address as calculated.
Well, yes, you translated the code from C to English. But the
question really was what you expect that it will happen after these
operations and what kind of a _meaning_ you ascribe to that.
> It should not matter if at x there is 8 bytes of a double, as that
> distinction is superflous to the equation.
But if you think that some consistent results should come from this
program then you assume that such "pointer puns" have a well defined
semantics. I do not recall that they ever had.
> anyway the segment was taken from a floor() function (akin to glibc:
> ./sysdeps/ieee754/dbl-64/s_floor.c).
This may even work for some particular platform and some particular
compiler, so it may be ok in internals of libraries, but it does
not mean that it can be copied elsewhere.
Michal
_______________________________________________
Axp-list mailing list
Axp-list@redhat.com
https://listman.redhat.com/mailman/listinfo/axp-list
This archive was generated by hypermail version 2a22 on Sat May 5 06:18:13 2001 PDT
Send any problems or questions about this archive to webmaster@alphalinux.org.