Skip to content

Commit 8ee5d18

Browse files
committed
address comments
1 parent f565e85 commit 8ee5d18

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/std/pointers.nim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
Convenience procs to deal with pointer-like variables.
33
]##
44

5-
proc toUncheckedArray*[T](a: ptr[T]): ptr UncheckedArray[T] {.inline.} =
6-
## calls `cast[ptr UncheckedArray[T]]` (less error prone).
5+
proc toUncheckedArray*[T](a: ptr T): ptr UncheckedArray[T] {.inline.} =
6+
## Shortcut for `cast[ptr UncheckedArray[T]](a)`, where T is inferred.
7+
## This allows array indexing operations on `a`.
8+
## This is unsafe as it returns `UncheckedArray`.
79
runnableExamples:
810
var a = @[10, 11, 12]
911
let pa = a[1].addr.toUncheckedArray

0 commit comments

Comments
 (0)