Commentary

ajs at hpfcla.UUCP ajs at hpfcla.UUCP
Sat Jul 14 07:28:00 AEST 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"



More information about the Comp.unix mailing list