I feel {.noInit.} pramga does not work. I misunderstood?
var
arr0: array[0..2, int]
arr1 {.noInit.}: array[0..2, int]
# it seems noInit does not work.
assert arr0 == arr1
type
Obj = object
x: int
y: string
var
obj0: Obj
obj1 {.noInit.}: Obj
# it seems noInit does not work.
assert obj0.x == 0
assert obj0.y == nil
assert obj0 == obj1
Even in the case of "-d:release", same result.
My environment:
Nim Compiler Version 0.11.2 (2015-07-03) [Linux: amd64]
Copyright (c) 2006-2015 by Andreas Rumpf
git hash: 45b6082c12dd6fc90a3dd3ca97e1ba157c3d6464
active boot switches: -d:release
I'm not sure what you are expecting. {.noinit.} makes no guarantees about the content of a variable, and for global variables, it will generally result in the same initial value, anyway. All that {.noinit.} says is that it won't explicitly assign default values; the variable will still have some value. In the case of global variables, whatever's associated with zeroed memory; in the case of local variables, whatever's been on the stack location/in the register.
For me, all the asserts work, and that's pretty much what I'd expect.