Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!ucla-cs!uci-ics!zardoz!tgate!ka3ovk!drilex!axiom!linus!alliant!palladium!nw From: nw@palladium.UUCP (Neil Webber) Newsgroups: comp.lang.c Subject: Re: Help, page 197 K&R !!! Message-ID: <740@palladium.UUCP> Date: 3 Jul 89 16:26:05 GMT References: <646@kl-cs.UUCP> <648@kl-cs.UUCP> <10481@smoke.BRL.MIL> Reply-To: nw@palladium.UUCP (Neil Webber) Organization: Epoch Systems, Marlborough, MA Lines: 33 In article <10481@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: >In article cline@sun.soe.clarkson.edu (Marshall Cline) writes: >> { char *p; >> p->squiggle = 3; /* implicit cast of "p" to "(worm_t *)p" */ > >I don't think that was ever allowed; some older C compilers did permit >pointers to one structure type to be used to access members of another >structure type, but that's as weird as I recall it getting. It looks to me like it got weirder than that, although I have to confess I have no direct experience with the older systems. Consider this gem from adb: double fw; /* Bourne-isms removed for readability */ struct{ long int sa; short sb,sc; }; . . . fw.sb=get(inkdot(4),itype); fw.sc=get(inkdot(6),itype); Yes, that's right -- "fw" is type "double" and it is being used as a structure for bit-twiddling purposes. -- Neil Webber / Epoch Systems, Marlboro MA / (508) 481-3717 {harvard!cfisun, linus!alliant}!palladium!nw