>>>> "Nix" == nix
<nix(a)esperi.demon.co.uk> writes:
Nix> On Mon, 22 Jul 2002, Martin Buchholz uttered the following:
>>
>>>> "Nix" == nix
<nix(a)esperi.demon.co.uk> writes:
>
Nix> On Sat, 20 Jul 2002, Martin Buchholz moaned:
Nix> In many cases, GCC will notice things like
>
Nix> (foo *) ((void *) bar)
>
Nix> and elide the useless cast to `void *'.
>
>> C is not Elisp. There is no "code"
there to be elided.
Nix> Quite so: but the compiler is permitted to *ignore* that cast to `void
Nix> *' when it comes to determining what the expression is permitted to
Nix> alias.
I see what you mean now.
Yes, the compiler is allowed to (and probably should) always treat
(foo *) ((void *) bar)
identically to
(foo *) bar
Deterring the compiler from making aliasing optimizations involves
making many annoying code changes, typically involving the use of
unions.
My attempt to inhibit aliasing optimizations by accessing data
using a type like the following
typedef union { char c; void *p; } *dfc_aliasing_voidpp;
works with gcc, but not with some other compilers. It is technically
insufficient. This is why the DFC_ macros use memcpy.