Subject: Re: GNU config.guess and netbsd{aout,elf,}
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-toolchain
Date: 11/24/1999 00:48:55
>> 	u_short VOLATILE rem;
>> 	rem = 0;
>> 	*(VOLATILE char *)&rem = buf[len-1];

> The result of dereferencing a casted pointer is explicitly
> implementation-defined in ANSI C.  It was never defined at all in K&R
> C.  So at best this is non-portable code.

Is it any less portable than other similar goop we already depend on,
like the way a softc has to begin with a "struct device"?

Also, there are some cases of pointer casts that I believe are
well-defined, though I don't think the above example is one of them.
The example that comes to mind - I hope it's correct! - is that if a
pointer to a union is cast to a pointer to one of its member types, the
result points to that member....

I also suspect that the above must "work" because of special cases for
adding and removing qualifiers in casts, and the special status of
"char *" (and "void *") as generic pointers.

					der Mouse

		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B