Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!usc!srhqla!demott!kdq From: kdq@demott.COM (Kevin D. Quitt) Newsgroups: comp.lang.c Subject: Re: Brain Teaser Message-ID: <100@demott.COM> Date: 29 Mar 90 19:40:07 GMT References: <12726@ulysses.att.com> Reply-To: kdq@demott.COM (Kevin D. Quitt) Organization: DeMott Electronics Co., Van Nuys CA Lines: 39 In article <12726@ulysses.att.com> cjc@ulysses.att.com (Chris Calabrese) writes: >In article <99@demott.COM>, kdq@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@demott.com "Next time, Jack, write a God-damned memo!" - Jack Ryan - Hunt for Red October