[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

Re: "delete" and the Smalltalk translator



> From mark Wed Jun 20 17:14:40 1990
> 
> [...]  The suggested change to the translator is to have
> 
> 	(expr) destroy.
> 
> translate to
> 
> 	Heaper * tmp;
> 	tmp = (expr);
> 	delete tmp;
> 
> and have
> 
> 	(expr) delete.
> 
> translate to
> 
> 	delete (expr);
> 

Let's make it a LITTLE different:

	(expr) destroy  =>  DESTROY (expr)

and include the macro:

	#define	DESTROY(expr)			\
		{				\
			Heaper * tmp = (expr);	\
			delete tmp;		\
		}

in tofux.hxx.  (Note that this will work even if the variable
"tmp" had been in scope, and cfront 2.0 will warn you if it
appears in (expr).)

(Hmmm...  If we didn't capitalize "destroy", does the translator still
 need a special case?)

> What do you guys think?  If I hear no objections, I'll probably do
> this. 

Sounds good to me.

By the way, are there any other special-cases in the translator that
might be simplified or eliminated by defining a support macro?  As long
as our code is going through a (set of) preprocessor(s) already, we might
as well give them something to do.

[Also by the way:  I strongly prefer "func(...)" to "func (...)".]

	michael