Re^2: Oh noooooo!!

Doug McDonald mcdonald at aries.uiuc.edu
Sun Oct 1 03:28:17 AEST 1989


If data-flow analysis is made difficult by goto-s, why should be any different
for a program restructured, probably by use of 
flag variables (which are exactly equivalent to assigned-goto-s
in Fortran). C is sufficiently rich in constructs that goto-s
are used only for really pathological cases (at least that is how I
use them, and I really love to tweek the toes of goto-haters) such as
multilevel breaks and genuine, uncontrollable, spaghetti logic.

I have two programs in which the control structure is so awful
(they parse English!) that the only hope of de-goto-ing them is
to use a state variable and a huge, really huge, switch statement
in which the goto-labels are replaced by case-labels. Why would
this be easier to understand for purposes of optimization: an
optimizer still should figure out that certain labels can follow
only after the execution of certain other code, and not dump
(for example) all the variables it has put in registers out of them.

Do C optimizers give up on switch statements also?

Doug McDonald (mcdonald at aries.scs.uiuc.edu)
(Aries is our new Mips machine. I hope this address works - it
should if you name resolver is working right. Aries has a twin,
Taurus. If we get a third, I am going to demand that it follow
the same line and be Camelopardalus!)



More information about the Comp.lang.c mailing list