This was discussed on the forum not too long ago. ( https://www.purebasic.fr/english/viewto ... 83#p586083 )
Code: Select all
Structure ArrayOfPointer
*Index[0]
EndStructure
Procedure test(index)
Protected *addr.ArrayOfPointer = ?jt
Protected result, *a
DataSection : jt:
Data.i ?l0 , ?l1 , ?l2 , ?l3 , ?l4
EndDataSection
If (index < 5 ) And (index >= 0)
CompilerIf #PB_Compiler_Backend = #PB_Backend_C
!goto *(void*)p_addr->f_index[v_index];
CompilerElse
EnableASM
jmp *addr\Index[index]
DisableASM
CompilerEndIf
Else
Goto le
EndIf
l0:
result = 0
Goto lE
l1:
result = -1
Goto lE
l2:
result = -2
Goto lE
l3:
result = -3
Goto lE
l4:
result = -4
lE:
ProcedureReturn result
EndProcedure
Debug test(3)The compiler converts Select into approximately the same code
