vla icon indicating copy to clipboard operation
vla copied to clipboard

invalid pragma: unchecked

Open HJarausch opened this issue 3 years ago • 3 comments

Using vla with Nim devel (GIT 2021-02-22) doesn't compile

vla.nim(6, 19) Error: invalid pragma: unchecked

HJarausch avatar Mar 07 '21 17:03 HJarausch

Please try it now.

bpr avatar Mar 08 '21 15:03 bpr

Thanks! In addition to your patch, I have applied the following patch

 template asOpenArray*[T](a: VarLengthArray[T]): openarray[T] =
-  cast[seq[type(a[0])]](a)
+  toOpenArray(addr a.data[0],0,a.len)

using the new? toOpenArray function from system.nim

I am pondering about adding a VarLengthArray which lives on the heap. Probably one has to use create and dealloc

HJarausch avatar Mar 08 '21 17:03 HJarausch

Thanks, I'll make that change as soon as I have some time. Also, it's come to my attention that the test suite is deficient. Oh, BTW, PRs are welcome!

bpr avatar Mar 10 '21 17:03 bpr