system.nim makes use of the 'unchecked' pragma

This commit is contained in:
Araq 2014-03-05 21:30:02 +01:00
commit c5db5875f7
2 changed files with 7 additions and 1 deletions

View file

@ -185,6 +185,8 @@ proc `..`*[T](b: T): TSlice[T] {.noSideEffect, inline.} =
when not defined(niminheritable): when not defined(niminheritable):
{.pragma: inheritable.} {.pragma: inheritable.}
when not defined(nimunion):
{.pragma: unchecked.}
const NoFakeVars* = defined(NimrodVM) ## true if the backend doesn't support \ const NoFakeVars* = defined(NimrodVM) ## true if the backend doesn't support \
## "fake variables" like 'var EBADF {.importc.}: cint'. ## "fake variables" like 'var EBADF {.importc.}: cint'.
@ -194,9 +196,10 @@ when not defined(JS):
TGenericSeq {.compilerproc, pure, inheritable.} = object TGenericSeq {.compilerproc, pure, inheritable.} = object
len, reserved: int len, reserved: int
PGenericSeq {.exportc.} = ptr TGenericSeq PGenericSeq {.exportc.} = ptr TGenericSeq
UncheckedCharArray {.unchecked.} = array[0..100_000_000, char]
# len and space without counting the terminating zero: # len and space without counting the terminating zero:
NimStringDesc {.compilerproc, final.} = object of TGenericSeq NimStringDesc {.compilerproc, final.} = object of TGenericSeq
data: array[0..100_000_000, char] data: UncheckedCharArray
NimString = ptr NimStringDesc NimString = ptr NimStringDesc
when not defined(JS) and not defined(NimrodVM): when not defined(JS) and not defined(NimrodVM):

View file

@ -60,6 +60,9 @@ News
virtual machine. This fixes numerous bugs for ``nimrod i`` and for macro virtual machine. This fixes numerous bugs for ``nimrod i`` and for macro
evaluation. evaluation.
- ``--gc:none`` produces warnings when code uses the GC. - ``--gc:none`` produces warnings when code uses the GC.
- A ``union`` pragma for better C interoperability is now supported.
- Arrays can be annotated to be ``unchecked`` for easier low level
manipulations of memory.
Language Additions Language Additions