Shifting meanings: "Spaghetti Code"?

Sridhar Ayengar ploopster at gmail.com
Thu Aug 16 19:54:46 CDT 2007


Jim Leonard wrote:
>> Although, I might consider assembler code where every second instruction 
>> is a jump to be spaghetti code.
> 
> Actually, I'd consider the opposite.  In assembler with something
> like:
> 
> cmp ax,01
> je  @1
> cmp ax,02
> je  @2
> 
> ...etc, at least you know what the value is that is causing the
> jump.  With a jump table, you have to do some digging.
> 
> I'm still going to code jump tables, obviously, but the former is
> easier to understand to someone looking at the code for the first time.

I meant more like

tag1	mov r1,loc1
	jmp tag2
tag2	mov r2,loc2
	jmp tag3
tag3	mov r3,loc3
...
...

etc. etc.

I have seen people write code like that.

Peace...  Sridhar


More information about the cctalk mailing list