> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Sam Tregar
> Sent: Monday, July 11, 2005 4:50 PM
> To: Jochen Cichon
> Cc: html-template-users@lists.sourceforge.net
> Subject: Re: [htmltmpl] (no subject)
> 
> 
> On Mon, 11 Jul 2005, Jochen Cichon wrote:
> 
> > Hm, was my first Idea also,
> > 
> > but why is condition evaluated a second time ONLY if it is 
> TRUE on the first
> > run?
> 
> HTML::Template compiles an IF/ELSE into two JUMP IF ops:
> 
>      JUMP to A IF false
>      ...
>      ...
>      JUMP TO B IF true
>   A: ...
>      ...
>      ...
>   B: ...

Well, I'm probably missing something (or everything), but it seems to me
that the following compiled code layout could solve the problem:

        JUMP to A IF false
        ... # first true instruction
        ...
        ... # last true instruction
        JUMP TO B
A:      ... # first false instruction
        ...
        ... # last false instruction
B:      ... # normal execution after the IF/ELSE, if any...


Anyway I would say that, in general, re-evaluating twice the predicate
for a single IF/ELSE clause execution should be avoided at all costs.

Ciao,
Emanuele.



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to