Remix.run Logo
russellbeattie 12 hours ago

Browsing the code, I've never seen this form of goto:

   GOTO(1100,1004,1013,1020,1004,1004)(IKIND+1)
I just looked it up. It's a multi-way branch: GOTO(label_1, label_2, label_3, etc.), integer_expression.

If the integer value is 1 (not zero), control flow transfers to label_1, if the value is 2, it transfers to the second label, etc.

Interesting! It's like a simplified switch statement.

tgv 9 hours ago | parent | next [-]

I think it's called a computed goto in FORTRAN: https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vn9l/inde...

mayank 12 hours ago | parent | prev | next [-]

Indeed! It’s a form of a branch table: https://en.m.wikipedia.org/wiki/Branch_table

beej71 11 hours ago | parent | prev [-]

A number of BASICs had ON GOTO to accomplish this, IIRC. It's been a few decades since I've used it, though. :)

kragen 11 hours ago | parent [-]

Yep. And ARM Thumb has the tbb and tbh instructions: https://devblogs.microsoft.com/oldnewthing/20210615-00/?p=10...