-
Notifications
You must be signed in to change notification settings - Fork 162
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
AGS 4 / new compiler: support dynamic arrays of normal structs #1818
Comments
At first sight I'd think that you're right, this should work. I don't see any problems that could come up if this limitation were removed. We'd need to make sure, however, that the struct doesn't contain any dynamic entities, either directly or indirectly. |
Yes, I could implement this, by eliminating the error message and adding a check to make sure that From the vantage point of the game coders, the code would be very similar to the code below that both the compilers can compile:
In the example above, after initializing the array |
Note that compiler will still have to deny dynamic arrays of structs that have nested managed pointers, until #1923 is completed. |
A note, that #1923 was finished and is working, so perhaps this could be done now with less checks. |
Addressed in #2106 |
Implemented by #2106. Example of use:
|
I've been wondering, if it's possible to support dynamic arrays of non-managed structs?
For example:
Above results with error in the extended compiler:
(old compiler does not error on declaration, but on the
new
operator instead)Right now this is restricted in both old and new compilers. Although, theoretically, you should be able to store an element of any size in dynamic arrays. Perhaps there have been a problem in coding accessing these elements, or anything else I cannot think of right now?
The text was updated successfully, but these errors were encountered: