[OT] [sdiy] IN your mind, what is ....

Rainer Buchty buchty at cs.tum.edu
Wed Feb 4 11:01:06 CET 2004


> Not a simpler solution, but it keeps the pointer stack clean which is a
> goto cannot do.

A goto statement does *not* affect the stackpointer. It's the counterpart
to JMP/BRA in assembly language. All it does, is setting the program
counter. The stack pointer is influenced by gosub or, for that matter, any
function or procedure call.

And that is the only reason why goto should be considered harmful:
Compilers can't really cope with goto statements which in the end usually
results in a higher amount of pipeline flushes or improperly filled
pipelines (depending on the architecture).

But there are situations where a goto just makes more sense than anything
else. Sure you can always program your way around it, but then you might
end up with a "from the back and the chest into the eye" (von hinten durch
die Brust ins Auge) kind of solution.

> I design code to run 24/7.  goto statements are forbidden in my work.

Here we come into the religious part.

Or as Don put it: "Eliminating the GOTO is Political Correctness applied
to software." ... I like that statement.

Rainer (wondering if a JMP must be replaced by LDD #addr ; PUSHS A,B ;
	PULS PC)



More information about the Synth-diy mailing list