Added few documentation lines for the unsafeAddr operator. (#5362)
This commit is contained in:
parent
434a7c8426
commit
d4b4cad4ea
1 changed files with 7 additions and 3 deletions
|
|
@ -154,9 +154,13 @@ proc `addr`*[T](x: var T): ptr T {.magic: "Addr", noSideEffect.} =
|
||||||
discard
|
discard
|
||||||
|
|
||||||
proc unsafeAddr*[T](x: T): ptr T {.magic: "Addr", noSideEffect.} =
|
proc unsafeAddr*[T](x: T): ptr T {.magic: "Addr", noSideEffect.} =
|
||||||
## Builtin 'addr' operator for taking the address of a memory location.
|
## Builtin 'addr' operator for taking the address of a memory
|
||||||
## This works even for ``let`` variables or parameters for better interop
|
## location. This works even for ``let`` variables or parameters
|
||||||
## with C and so it is considered even more unsafe than the ordinary ``addr``.
|
## for better interop with C and so it is considered even more
|
||||||
|
## unsafe than the ordinary ``addr``. When you use it to write a
|
||||||
|
## wrapper for a C library, you should always check that the
|
||||||
|
## original library does never write to data behind the pointer that
|
||||||
|
## is returned from this procedure.
|
||||||
## Cannot be overloaded.
|
## Cannot be overloaded.
|
||||||
discard
|
discard
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue