call to revolt

John F. Woods jfw at ksr.com
Fri Jun 28 00:45:47 AEST 1991


diamond at jit533.swstokyo.dec.com (Norman Diamond) writes:
>In article <992 at baby.and.nl> jos at and.nl (J. Horsmeier) writes:
>>Hi there, I'll die if casting lvals is going to be illegal.
>>type* Thing;
>>((int)Thing)= Thing-Base+1;
>You'll die if you have to write
>  Thing = (type*) (Thing-Base+1);
>My heart bleeds for you.

Well, in fact, the second line isn't actually obligated to do what is
apparently desired, i.e. to copy the integer value bit-for-bit into the
pointer; the cast to a pointer is entitled to (if deemed desirable by the
compiler writer) change the representation to something that the hardware
would find more convenient.  The problem isn't really that J. Horsmeier
doesn't understand the subtleties of the language, it's that he doesn't
understand the fairly gross problem of portability.

To accomplish exactly what this person thinks is desired requires a union,
but of course that course is still fraught with peril, because the thing being
done is non-portable.

The bulk programming community seems to have gone from undergraduate VAX
programmers who just don't understand portability issues to geeky 8086
programmers who actively misunderstand portability; thank goodness Intel
is trying to exterminate all future microprocessor architectures in favor of
their washing-machine controller, or the next generation of programmers
might be completely useless!	:-)



More information about the Comp.std.c mailing list