Commentary

rob at rabbit.UUCP rob at rabbit.UUCP
Sat Jul 14 05:49:55 AEST 1984


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);
}

And the improved version:
/********************************************************************************
 *										*
 *										*
 *				bltin						*
 *										*
 *										*
 ********************************************************************************/
/*
 *			Evaluate a built-in
 */
bltin() 		/* Declare the function */
{

	Datum d;	/* Declare the variable d of type Datum */
	d = pop();	/* Call pop() and place the result in d, which was
			   (conveniently) already declared */
	/*
	 * This is the clever part
	 */
	d.val = (*(double (*)())*pc++)(d.val);
	/*
 	 * Whew! that was hard.
	 */
	push(d);	/* Return a result */

}
/********************************************************************************
 *										*
 *										*
 *				end of bltin					*
 *										*
 *										*
 ********************************************************************************/



More information about the Comp.unix mailing list