Closed GWRon closed 4 years ago
Replacing that "struct getter" with this:
'set first break index to "none" so rendering only breaks if needed
local lineInfo:STextParseLineInfo = GetLineInformation(1)
lineInfo.lineBreakIndex = -1
this line is not creating an error anymore.
Yet I think it is the wrong way to "retrieve" a specific struct - and to replace values in there. How to better do that?
Seems this is only "doable" with types ... anyways the error might better be catched by BCC already.
Just as information: I used this kind of Indirection (line information struct instead of various arrays) as I had for each property two array: Field StaticArray property:Short[10] Field propertyDynamic:Short[]
As this allowed me to have a "fixed size" struct which could - in case of "longer than usual" multi-line texts extend beyond the static assumptions. So for most "cases" the struct worked without using the Garbage Collector at all.
The indirection then "chose" the right array for me and returned the entry of interest.
We talked about this on discord, so just a quick summary of the actual error here:
Struct S
Field i:Int
End Struct
Function F:S()
End Function
F().i = 1
C:/Programmierung/BlitzMax-NG latest/tmp/.bmx/untitled1.bmx.console.release.win32.x86.c: In function '_bb_main': C:/Programmierung/BlitzMax-NG latest/tmp/.bmx/untitled1.bmx.console.release.win32.x86.c:63:38: error: lvalue required as left operand of assignment _m_untitled1_F().__m_untitled1_s_i =1;
Since F().i = 1
makes no real sense (it's an assignment to a field of a struct instance that is immediately discarded afterwards, so essentially a no-op), maybe it shouldn't be allowed either way. But it should be a proper compile error from bcc, not invalid C code.
Another bug that's not directly related, but might as well mention it here anyways:
Struct S
End Struct
Local x:S
Local p:S Ptr = x
C:/Programmierung/BlitzMax-NG latest/tmp/.bmx/untitled2.bmx.console.release.win32.x86.c:49:40: error: cannot convert to a pointer type struct _m_untitled2_S bbt_p=(struct _m_untitled2_S)bbt_x;
This should also be a proper compile error.
leads to this C error:
(and a lot of other ones ... )
Generated C code there is: