ZScript - Multi-dimensional array declarations are backwards

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
YukiRaven
Posts: 43
Joined: Mon Jul 09, 2018 11:13 pm
Graphics Processor: nVidia with Vulkan support
Location: Colorado, United States
Contact:

ZScript - Multi-dimensional array declarations are backwards

Post by YukiRaven »

In ZScript, I noticed that the subscripts for multi-dimensional arrays are backwards in their declaration. For example, this is how I expect to declare a multi-dimensional array:

Code: Select all

int myArray[4][2];

...

myArray[3][0] = 42;  // ERROR
This is how I end up needing to do it, however:

Code: Select all

int myArray[2][4];  // Same as myArray[4][2] in other languages

...

myArray[3][0] = 42;  // This now works
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: ZScript - Multi-dimensional array declarations are backw

Post by Nash »

Already reported [ viewtopic.php?f=2&t=56491 ] but to be honest I don't see this being fixed any time soon...
User avatar
YukiRaven
Posts: 43
Joined: Mon Jul 09, 2018 11:13 pm
Graphics Processor: nVidia with Vulkan support
Location: Colorado, United States
Contact:

Re: ZScript - Multi-dimensional array declarations are backw

Post by YukiRaven »

Ahh, my search-fu is lacking.

I'll adjust my own code for the time being.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript - Multi-dimensional array declarations are backw

Post by Graf Zahl »

Noticed too late, unfortunately. And don't worry about using the swapped dimensions. If this gets fixed it needs to be versioned anyway so that older ZScript sources can remain as they are.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: ZScript - Multi-dimensional array declarations are backw

Post by Major Cooke »

Huh... I thought it was outright non-functional but seeing as it's just backwards? Interesting. Still, I'll refrain from using those until after the fix is committed.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript - Multi-dimensional array declarations are backw

Post by Graf Zahl »

Don't expect anything to happen here any time soon. This is a structural problem in how the parser processes types and cannot be fixed without introducing some real compatibility problems.
Post Reply

Return to “Closed Bugs [GZDoom]”