Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!laidbak!daveb From: daveb@laidbak.UUCP (Dave Burton) Newsgroups: comp.lang.c Subject: Re: register unions Keywords: registers, unions Message-ID: <1338@laidbak.UUCP> Date: 16 Feb 88 04:23:42 GMT References: <1229@eneevax.UUCP> Reply-To: daveb@laidbak.UUCP (Dave Burton) Distribution: comp.lang.c Organization: is pretty bad/My method of Lines: 31 In article <1229@eneevax.UUCP> noise@eneevax.umd.edu.UUCP (Johnson Noise) writes: | typedef union | { | char b; | short w; | long l; | } dreg; | | typedef union | { | char *b; | short *w; | long *l; | } areg; | | register dreg d0, d1, d2; | register areg a0, a1; | |which would effectively allow full use of cpu registers. Note the |similarity to 68k assembly. Though not specifically disallowed in the original specification of C, this declaration is not useful in the manner you propose. K&R (pg 197) and H&S (pg 109) state that storage is allocated from the beginning of the union. The 68k series put the char type in the LSB, while the union declarations want the char type in the MSB. -- --------------------"Well, it looked good when I wrote it"--------------------- Verbal: Dave Burton Net: ...!ihnp4!laidbak!daveb V-MAIL: (312) 505-9100 x325 USSnail: 1901 N. Naper Blvd. #include Naperville, IL 60540