added system.unsafeAddr

This commit is contained in:
Araq 2015-08-04 17:31:00 +02:00
commit ab26298a03
7 changed files with 48 additions and 16 deletions

View file

@ -153,6 +153,13 @@ proc `addr`*[T](x: var T): ptr T {.magic: "Addr", noSideEffect.} =
## Cannot be overloaded.
discard
proc unsafeAddr*[T](x: var T): ptr T {.magic: "Addr", noSideEffect.} =
## Builtin 'addr' operator for taking the address of a memory location.
## This works even for ``let`` variables or parameters for better interop
## with C and so it is considered even more unsafe than the ordinary ``addr``.
## Cannot be overloaded.
discard
proc `type`*(x: expr): typeDesc {.magic: "TypeOf", noSideEffect.} =
## Builtin 'type' operator for accessing the type of an expression.
## Cannot be overloaded.