Bug in users command
Norman Diamond
diamond at jit345.swstokyo.dec.com
Thu Jan 24 17:01:13 AEST 1991
In article <1991Jan24.004044.13362 at craycos.com> pmk at craycos.com (Peter Klausler) writes:
>Given the declaration
> char (*a)[N];
>the expressions
> (char *) a
> &((*a)[0])
> *a
>are all valid in ANS X3.159-1989, all of type "char *", and all yield pointers
>to the same char object.
No. The last two yield pointers to the same char object, the first char in *a.
The first one coerces a pointer-to-array to a pointer-to-char value.
The standard guarantees that you can take a pointer-to-something, cast it to
a pointer-to-char, cast it back to a pointer-to-something, and the result is
equivalent to the original pointer. It does not guarantee that the value
with type pointer-to-char can actually be used for anything.
--
Norman Diamond diamond at tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list