Casting a postdecrement operand
David DiGiacomo
david at sun.uucp
Thu Jun 5 06:00:39 AEST 1986
In article <1764 at umcp-cs.UUCP> chris at maryland.UUCP (Chris Torek) writes:
>Incidentally, if you really *do* want to take a pointer `p' to
>type `x', but treat it as a pointer to type `y', the construct
>
> *(y **)&p
>
>works (as long as `p' is addressable). Thus
>
> ((struct abc *)cbap)++;
>
>is not legal, but
>
> (*(struct abc **)&cbap)++;
>
>is (again, if cbap is addressable). What it means is machine
>dependent!
This is disgusting... why not use
cbap = (struct cba *) ((caddr_t) cbap + sizeof(struct abc));
?
--
David DiGiacomo {decvax, ihnp4, ucbvax}!sun!david david at sun.arpa
Sun Microsystems, Mt. View, CA (415) 960-7495
More information about the Comp.lang.c
mailing list