Brain Teaser

Kevin D. Quitt kdq at demott.COM
Fri Mar 30 05:40:07 AEST 1990


In article <12726 at ulysses.att.com> cjc at ulysses.att.com (Chris Calabrese) writes:
>In article <99 at demott.COM>, kdq at demott.COM (Kevin D. Quitt) writes:

 [... my stuff deleted ]

>NO, NO, NO, NO, NO!!!
>This only works on machines where a pointer is a simple number!!!
>It doesn't work on machines with segmented architecture (intel, etc).

    It *DOES* work on the intel machines.  The only Intel processors it
might not work on are the 386 and 486, since they have 48 bit addresses. 
But the C compilers for these processors don't give you direct access to
48bit addresses. 

>And, it doesn't work on machines with different sized pointers for
>different types of pointers (Dual 86/80?).

    It *WILL* work on any machine whose long data is as big as the
address.  It will not work (as has been pointed out to me) on some of
the BULL machines, which have 32 bit addresses (for words) and an
additional 16 bits for character address offset, and whose C compiler
use 48 bits for pointers.

    On the other hand, you could union the pointer to a character, int
or long array and do the conversion piecewise.  (Again, nobody said anything
about efficiency).

    (Asbestos undergarments in place...  (:-{>}

kdq
-- 

Kevin D. Quitt                          Manager, Software Development
DeMott Electronics Co.                  VOICE (818) 988-4975
14707 Keswick St.                       FAX   (818) 997-1190
Van Nuys, CA  91405-1266                MODEM (818) 997-4496 Telebit PEP last
34 12 N  118 27 W                       srhqla!demott!kdq   kdq at demott.com

 "Next time, Jack, write a God-damned memo!" - Jack Ryan - Hunt for Red October



More information about the Comp.lang.c mailing list