Skip to content
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

Allow casting to/constructing of array type #15

Open
matt-attack opened this issue Jul 29, 2017 · 1 comment
Open

Allow casting to/constructing of array type #15

matt-attack opened this issue Jul 29, 2017 · 1 comment

Comments

@matt-attack
Copy link
Owner

Currently there is no way to instantiate an array type without also allocating an array. Perhaps allow user to instantiate on the stack a [] object and assign to it manually.

let int[] arr;
arr.size = 5;
arr.ptr = <int*>malloc(5*4);

More complex syntax could also be allowed which lets the user construct it like any other object.

let arr = int[](5, <int*>malloc(5*4));
@matt-attack
Copy link
Owner Author

It's possible the first case is already workable, but it doesn't initialize the values to anything and is a potential safety issue. If that's true, just work on the second type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant