You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There was a question on SyntaxBomb about arrays. During the answer I found out, that this wrong code line does not raise an error message in BlitzMax NG DEBUG and RELEASE mode:
Global Test:Int[1, 1, 2]' now call the array with one dimension too small, but no error message:
Test[0,0]=4
Print Test[0,0,0]+""+ Test[0,0,1]
I asked for the output of vanilla:
Building untitled1
Compiling:test.bmx
Compile Error: Incorrect number of array dimensions
[C:/code/test.bmx;4;1]
Build Error: failed to compile C:/code/test.bmx
Process complete
Maybe bcc could spit out a similar error (maybe even with "given vs required")
The text was updated successfully, but these errors were encountered:
The generated code indicates that the C code uses "1 dimensional arrays" and simply adds up the passed indices of the multi-dimensional access to a single index.
Local int_array:Int[1,1,2]
int_array[0,0]=4
int_array[1,0,0]=4
Does not help much though -- regarding the BCC checks, but explains why it is "working" (as long as you just leave out dimensions / aka setting their index indirectly to "0")
GWRon
changed the title
BCC allows to access multi-dim arrays with less dimensions
BCC allows to access multi-dim arrays with less/more dimensions
Jan 16, 2024
@MidimasterSoft wrote at discord:
I asked for the output of vanilla:
Maybe bcc could spit out a similar error (maybe even with "given vs required")
The text was updated successfully, but these errors were encountered: