mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-08 05:53:22 +00:00
14 lines
331 B
Nim
14 lines
331 B
Nim
type
|
|
ChunkObj = object
|
|
data: UncheckedArray[byte]
|
|
|
|
proc alloc(size: int): ref ChunkObj =
|
|
unsafeNew(result, size)
|
|
|
|
proc main() =
|
|
let buf = alloc(10)
|
|
buf.data[9] = 100 # index out of bounds, because one byte is occupied by the 'dummy' field,
|
|
# the actual usable size of data is 9 bytes
|
|
|
|
main()
|