TY: Introduce array of unknown size
See original GitHub issueThis code is ok, but syntax checker marks array as wrong
const COUNT: usize = 2;
struct Foo {
v: [usize; COUNT]
}
fn bar(f: Foo) {}
fn main() {
bar(Foo{
v:[10, 20] // E308, expected [usize], found [usize; 2]
});
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
c++ - How to initialize an array whose size is initially unknown?
Size of dynamically created array on the stack must be known at compile time. You can either use new : const char* pArray...
Read more >How can I make an array of unknown size? - NI Community
Use Build Array.vi and shift register(s) to dynamically create the array. See the attached. For memory management, it is better to initialize the...
Read more >How to declare an array of undefined or no initial size - Quora
Let's say you want to create an array of integers of some size, which you are not aware of initially. So to declare...
Read more >Generating an array of unknown size : r/C_Programming
Hello everyone, I have some code where I am transforming a height map into a mesh, the end result would be an array...
Read more >Making Dynamic array - MATLAB Answers - MathWorks
I want to creat an array that is dynamic in size. I mean I dont know what is going to be the size...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Btw, we should probably use
Long
instead ofInt
for array size. Just because ifusize
is even 32-bit it’s still more than java’sint
and our type inference will fail on 3Gb arrays =DI know that feel bro