Help, page 197 K&R !!!

Neil Webber nw at palladium.UUCP
Tue Jul 4 02:26:05 AEST 1989


In article <10481 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>In article <CLINE.89Jul1102015 at sun.soe.clarkson.edu> cline at 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



More information about the Comp.lang.c mailing list