Related articles |
---|
Optimizing nested if statements? sperugin@csgrad.cs.vt.edu (Saverio Perugini) (2003-01-17) |
Re: Optimizing nested if statements? christian.bau@cbau.freeserve.co.uk (Christian Bau) (2003-01-21) |
Re: Optimizing nested if statements? terryg@qwest.net (Terry Greyzck) (2003-01-21) |
Re: Optimizing nested if statements? vbdis@aol.com (2003-01-21) |
Re: Optimizing nested if statements? sperugin@csgrad.cs.vt.edu (Saverio Perugini) (2003-01-25) |
Re: Optimizing nested if statements? Martin.Ward@durham.ac.uk (2003-01-26) |
Re: Optimizing nested if statements? sperugin@csgrad.cs.vt.edu (Saverio Perugini) (2003-02-06) |
From: | Christian Bau <christian.bau@cbau.freeserve.co.uk> |
Newsgroups: | comp.compilers |
Date: | 21 Jan 2003 00:11:36 -0500 |
Organization: | Compilers Central |
References: | 03-01-092 |
Keywords: | optimize |
Posted-Date: | 21 Jan 2003 00:11:36 EST |
Saverio Perugini <sperugin@csgrad.cs.vt.edu> wrote:
> Hello,
>
> Consider the following code:
>
> if (a) {
> if (b) {
> if (c) {
> ...
> } else if (d) {
> ...
> }
> }
> } else if (e) {
> ...
> }
>
> This code is semantically equivalent to
> the following piece of code.
>
> if (a) {
> if (b && c) {
> ...
> } else if (d) {
> ...
> }
> } else if (e) {
> ...
> }
I can't see that this is equivalent. The code after "if (d)" is executed
if a is false, b is true, c is false, d is true in the first case, and
if a is true, either b or c are false, d is true in the second case.
[You're right, it's not. But if we fix it and get his bracketing
right, it's still a reasonable question. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.