-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dimension declarations in 2D arrays reversed? #104
Comments
Oh, interesting. That's not actually supposed to work! I've just had else on another forum complain about only having single-dimension arrays, too... I will look into this; it's clearly almost working so it would be good to regularise. Thanks for the test case. |
Did not check the source but dare to ask anyway - is this already supported? |
sizeof for 2d arrays also returns unexpected values (bytesof is ok):
sizeof returns 2 |
Given the structure of the initialiser, I would expect sizeof in that case to return 2 --- there are two elements in the outermost array. What's happening here is that clearly [] is associative in the wrong direction. Which is a shame as it's much easier to parse this way round. |
Hello.
Here are two programs that ought to be equivalent, one in C and the other in Cowgol:
https://github.com/ibara/cowgol-utilities/blob/main/2darray.c
https://github.com/ibara/cowgol-utilities/blob/main/2darray.cow
However, they are not equivalent. The output from the C version is what I would expect but that is not the output from the Cowgol version. To get the expected output from the Cowgol version, swap the dimension index declaration on line 6. That is, put XMAX before YMAX in the Cowgol version, even though all other accesses are in the form [y][x].
This is a bit unexpected, so bringing it up in case it is not intentional.
Discovered when writing a Game of Life implementation in Cowgol.
The text was updated successfully, but these errors were encountered: