Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: notesfiles Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!cornell!uw-beaver!tektronix!hplabs!hp-pcd!hpfcla!ajs From: ajs@hpfcla.UUCP Newsgroups: net.unix Subject: Re: Commentary Message-ID: <43800013@hpfcla.UUCP> Date: Fri, 13-Jul-84 17:28:00 EDT Article-I.D.: hpfcla.43800013 Posted: Fri Jul 13 17:28:00 1984 Date-Received: Tue, 24-Jul-84 03:15:27 EDT References: <2967@rabbit.UUCP> Organization: Hewlett-Packard - Fort Collins, CO Lines: 52 Nf-ID: #R:rabbit:-296700:hpfcla:43800013:000:1638 Nf-From: hpfcla!ajs Jul 20 13:28:00 1984 From rabbit!rob (presumably Rob Pike, co-author of tUPE): > Sorry; i repent. here is an improved version of one of the hoc routines, > to set a new style of example. > > Here is the original: > bltin() > { > > Datum d; > d = pop(); > d.val = (*(double (*)())*pc++)(d.val); > push(d); > } > > [ followed by a horrendous example ] Ugh. Surely you jest. But it does you discredit, for you mockingly assume there is no better way to do it without getting ugly. Since you fired the opening round, I'll volley back with a better example (in all seriousness). Forgive me if the comments are erroneous; I'm not sure from your listing what exactly this procedure DOES. :-) And I'm not going to even try to untangle that (undoubtedly efficient but who cares?) ugly procedure call. /*********************************************************************** * B U I L T I N * * Call a built-in function with data from the expression stack and * advance the procedure pointer as a side-effect. The ugly procedure * call treats the current procedure pointer as a {hell I can't tell, * and cdecl doesn't help either, so it bloody well should be explained * here or below, because most of us aren't C compilers}. */ local void BuiltIn() { Datum data; /* working copy */ data = PopData(); data.value = (* (double (*)()) *proc++) (data.value); PushData (data); } /* BuiltIn */ /*********************************************************************** Alan Silverstein, Hewlett-Packard Fort Collins Systems Division, Colorado {ihnp4 | hplabs}!hpfcla!ajs, 303-226-3800 x3053, N 40 31'31" W 105 00'43"