register unions
Dave Burton
daveb at laidbak.UUCP
Tue Feb 16 14:23:42 AEST 1988
In article <1229 at eneevax.UUCP> noise at 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 <disclaimer.h> Naperville, IL 60540
More information about the Comp.lang.c
mailing list