a static array in structure is my favourite to create object handles ,
it runs fine as we know the bound of static array and we manage it ,
the compiler let go on release mode , but raise ERROR in debugger mode .
so i have miss the debugger function if i wish to use this tactic in code.
any tips to suppress this type of compiler error msg so i can continue to use debugger?
or this is by design ?
Code: Select all
; In 32bit x86 Purebasic 5.72 compiler
; This code runs fine in release mode ,
; but Give ERROR in Debugger Mode
;[12:53:24] [ERROR] Line: 52
;[12:53:24] [ERROR] Structure Array index out of bounds.
;[12:53:29] The Program was killed.
; -----------------------------------------------------
Structure dynaobject
name$
style.l
StructureUnion
show_body.l
show_section.l[1]
EndStructureUnion
; ----
show_Title.l
show_Header.l
show_FootBar.l
show_FloatOBJ.l
Show_Rec_status.l ; Only applicable to MODE = 1 , (Table/ Report)
EndStructure
Procedure.i X_CreateMyObject(ntools.l)
Protected *thisObj.dynaobject = AllocateMemory(SizeOf(dynaobject))
; Protected *thisObj.dynaobject = AllocateStructure(dynaobject)
ProcedureReturn *thisObj
EndProcedure
*myObj.dynaobject = X_CreateMyObject(6)
; set value in object
For i = 1 To 6
*myObj\show_section[i-1] = Random(6000)
Next
OpenConsole("Test Object")
PrintN("Size of object: " +Str(SizeOf(dynaobject)))
For i = 1 To 6
PrintN("Tools "+Str(i)+" value : "+Str(*myObj\show_section[i-1]))
Next
PrintN("Last value : "+Str(*myObj\show_section[5]))
Input()