Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!brl-tgr!tgr!cottrell@nbs-vms.ARPA From: cottrell@nbs-vms.ARPA Newsgroups: net.lang.c Subject: type punning Message-ID: <8253@brl-tgr.ARPA> Date: Mon, 11-Feb-85 19:30:49 EST Article-I.D.: brl-tgr.8253 Posted: Mon Feb 11 19:30:49 1985 Date-Received: Wed, 13-Feb-85 02:10:11 EST Sender: news@brl-tgr.ARPA Organization: Ballistic Research Lab Lines: 47 /* > > Note the lack of cast on h in Put_Tail. > > Oh, JHFC, Gary, RTFM. K&R says that the coercion of 0 to a null pointer > of the appropriate type is automatic in what amount to all situations where > the compiler can figure this out. Stop talking about the lack of casts > in statements like "if (!h)"; they never were required and never will be. Gotcha this time Guy! The omitted cast was in the funxion call to `insque'. Part of my message follows: ~ LINKP remque(LINKP p); /* remove p from list */ ~ { if (p) (p->fwd->bwd = p->bwd)->fwd = p->fwd; ~ return(p); ~ } ~ ~ LINKP insque(LINKP p,LINKP q); /* insert p after q */ ~ { if (p) (((p->fwd = q->fwd)->bwd = p)->bwd = q)->fwd = p; ~ return(p); ~ } ~ ~ LINKP Put_Head(HEADP h,LINKP p); /* put p to head of list h */ ~ { if (!h) return(0); /* null protect */ ~ ++h->cnt; /* one more */ ~ return(insque(h->link.fwd,p); /* put to head */ ~ } ~ ~ LINKP Put_Tail(HEADP h,LINKP p); /* put p to tail of list h */ ~ { if (!h) return(0); /* null protect */ ~ ++h->cnt; /* one more */ ~ return(insque(h,p); /* put to tail */ ~ } ~ ~ Note the lack of cast on h in Put_Tail. Admittedly this required you to muddle thru a lot of possibly boring code, but, he who lives by the nit dies by the pick. I have an idea what JHFC means, but what does RTFM mean? BTW, my name is not Gary, it's Jim. Okay, I figured it out. Better watch out, Guy, there is a pea-brain at Princeton who doesn't like "obscenity", even when it's encoded in asterisks. He sent a nastygram to our postmaster about my u-wiz message about `vm on a 680x0'. You know, the one that said: What the is this doing in unix-wizards? Hey, just kidding guys :-) */