Path: utzoo!utgpu!water!watmath!clyde!rutgers!umd5!brl-adm!husc6!sri-unix!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: register unions Keywords: registers, unions Message-ID: <677@cresswell.quintus.UUCP> Date: 22 Feb 88 04:26:23 GMT References: <1229@eneevax.UUCP> <7258@brl-smoke.ARPA> <604@mcrware.UUCP> Distribution: comp.lang.c Organization: Quintus Computer Systems, Mountain View, CA Lines: 23 In article <604@mcrware.UUCP>, jejones@mcrware.UUCP (James Jones) writes: > The place I can see people wanting unions to live in registers is something > like > register union { > woof *wp; > char *cp; > ... > } mumble; Last time I looked at a PR1ME C manual, most pointers were 32 bits, but character pointers were 48 bits. The P400 (the machine I used) has 32-bit registers. {There are also the "Field Address" and "Field Length" registers, one set of which overlaps a floating-point register...} If you really need to do this, you can manage it with casts. The cast version is a wee bit better than the union version, because Lint will complain about the casts, but the union code will just quietly do something surprising. for (times = 100; --times >= 0; ) { fprintf(stderr, "Byte addressing is not universal.\n"); fprintf(stderr, "Pointers may come in different sizes.\n\n"); }