Forum
Dim Array At Constant Issue (*solved*) - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15)
+---- Thread: Dim Array At Constant Issue (*solved*) (/showthread.php?tid=1005)



Dim Array At Constant Issue (*solved*) - Ljg701 - 01-12-2021

Hi,

I'm trying to dim an array at a specific address which has been defined as a constant of type uinteger, unless I add 0 to the constant the code does not compile. 

const tileStart as uinteger = $4000+384

dim tile(0 to 255) as uinteger at tileStart         'this fails to compile with "Address must be a numeric constant expression" 
'dim tile(0 to 255) as uinteger at tileStart+0         compiles OK

print at 0,0;str(tileStart)

Am I missing something?

This is version: [v1.14.0]


RE: Dim Array At Constant Issue - boriel - 01-12-2021

I'll check that. If you're right you've hit a bug! Thanks for reporting it
It will be fixed in 1.14.1 (soon to be released).
I'll keep you updated here! Smile


RE: Dim Array At Constant Issue - boriel - 01-12-2021

(01-12-2021, 03:27 PM)Ljg701 Wrote: Hi,

I'm trying to dim an array at a specific address which has been defined as a constant of type uinteger, unless I add 0 to the constant the code does not compile. 

const tileStart as uinteger = $4000+384

dim tile(0 to 255) as uinteger at tileStart         'this fails to compile with "Address must be a numeric constant expression" 
'dim tile(0 to 255) as uinteger at tileStart+0         compiles OK

print at 0,0;str(tileStart)

Am I missing something?

This is version: [v1.14.0]

Try this beta and tell me if it works, please! Rolleyes 
http://www.boriel.com/files/zxb/zxbasic-1.14.1-beta6.tar.gz
http://www.boriel.com/files/zxb/zxbasic-1.14.1-beta6.zip
http://www.boriel.com/files/zxb/zxbasic-1.14.1-beta6-win32.zip
http://www.boriel.com/files/zxb/zxbasic-1.14.1-beta6-linux64.tar.gz
http://www.boriel.com/files/zxb/zxbasic-1.14.1-beta6-macos.tar.gz


RE: Dim Array At Constant Issue - Ljg701 - 01-14-2021

Hello Boriel,

Yes that seems to have fixed the DIM AT issue.
:-)