Re: goto: it's conceded
- Posted by ken mortenson <kenneth_john at ?ahoo.c?m> Jun 02, 2008
- 684 views
Jeremy Cowgar wrote: > ken mortenson wrote: > > Without labels or GOTOs becomes... > > > > procedure example() > > while cond2 do > > ... > > while cond3 do > > ... > > if cond4 then > > ... > > end if > > if abc then return end if > > end while > > end while > > end procedure > > > > while cond1 do > > ... > > example() > > end while > > > > Have you considered the speed diffences? Yes, that's what I'm referring to when I speak of performance. There is no question that inline code is faster than a call. When speed is the paramount issue (and it seldom is) you would write this a different way but still without labels or gotos but the preferred way is to create a routine even if it's only used once. There is another solution. Just like assembler has it's macro facility you could have an INLINE compiler directive. procedure_A Loop INLINE procedure_B End Loop Procedure_C Say procedure A and C just run once so speed isn't a big issue, but B is inside a loop that iterates a million times. call/return could become an issue so we tell the compiler to inline the code and eliminate the call and return. Interpreted it probably wouldn't be worthwhile, but who knows? "Science is the belief in the ignorance of experts." - Richard Feynman