Created
March 26, 2015 05:07
-
-
Save fowlmouth/42c762d6ad81e7a4dfb9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Unchecked* {.unchecked.}[T] = array[1,T] | |
var x = [1,2,3] | |
let y = cast[ptr Unchecked[int]](x[0].addr) | |
echo y[0] | |
echo y[1] | |
echo y[2] | |
echo y[3] # stack garbage | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment