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

Rainer Buchty buchty at cs.tum.edu
Wed Feb 4 11:33:38 CET 2004


> 'continue' and 'break' (except in a switch statement) are effectively
> goto's!

It's even a goto in a switch statement, cause

	switch(a)
	{
		case 0:	...
			break;
		case 1: ...
			break;
		default:
			...
	}

translates to something like this (6809 assembly to keep it simple)


	LDA #a
	ASLA
	LDX #jump_table
	JMP [A,X]

or
	LDA #a
	CPMA #0
	BNE x1
		...a...
	BRA x3
x1:	CMPA #1
	BNE x2
		...b...
	BRA x3
x2:
		...default...
x3:

As an assembly programmer I would prefer the first solution whereas
compilers (to my knowledge) tend to like the second one which is a 1:1
translation of a switch/case statement.

Rainer



More information about the Synth-diy mailing list