1. RE: Empty procedure optimized out?
- Posted by "Ricardo M. Forno" <rmforno at tutopia.com> Nov 21, 2004
- 487 views
----- Original Message ----- From: Robert Craig <guest at RapidEuphoria.com> To: <EUforum at topica.com> Sent: Friday, November 19, 2004 6:58 PM Subject: Re: Empty procedure optimized out? > > > posted by: Robert Craig <rds at RapidEuphoria.com> > > Tommy Carlier wrote: > > > > Robert, couldn't you remove calls to empty procedures while parsing > > a program? I have a procedure to ignore the return value of a function, > > that looks like this: > > }}} <eucode> > > global procedure ignore(object ignored) > > -- ignores its parameter > > end procedure > > </eucode> {{{ > > And it's used like this: > > }}} <eucode> > > ignore(someFunction(someParameter1, someParameter2)) > > </eucode> {{{ > > The function 'someFunction' should be executed, but the call to the > > empty procedure could be removed. That could also optimize this > > situation: > > }}} <eucode> > > constant DEBUG = 0 > > > > procedure writeToLog(sequence line) > > if DEBUG then > > puts(logfile, line & '\n') > > end if > > end procedure > > </eucode> {{{ > > > > 'if DEBUG then' can be removed, because you know before running the > > code than it will never be called. That makes the 'writeToLog'-procedure > > an empty procedure that can be optimized out. > > Thanks. I'll add it to my list of possible optimizations. > > By the way, this was too trivial for the release notes, > but I took out the warning about parameters declared but not used. > I feel that these warnings were useful... What a pity you took them out. > Regards, > Rob Craig > Rapid Deployment Software _________________________________________________________________ Tutopia - Internet rapido y facil. Unico con Acelerador de navegacion gratis. www.tutopia.com