mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-09 06:23:25 +00:00
* fixes #19000
* progress
(cherry picked from commit 2bda4a30a6)
This commit is contained in:
@@ -116,6 +116,9 @@ when hasAlloc and not defined(js):
|
||||
##
|
||||
## See also:
|
||||
## * `create <#create,typedesc>`_
|
||||
static:
|
||||
when sizeof(T) <= 0:
|
||||
{.fatal: "createU does not support types T where sizeof(T) == 0".}
|
||||
cast[ptr T](alloc(T.sizeof * size))
|
||||
|
||||
template alloc0*(size: Natural): pointer =
|
||||
@@ -141,6 +144,9 @@ when hasAlloc and not defined(js):
|
||||
##
|
||||
## The allocated memory belongs to its allocating thread!
|
||||
## Use `createShared <#createShared,typedesc>`_ to allocate from a shared heap.
|
||||
static:
|
||||
when sizeof(T) <= 0:
|
||||
{.fatal: "create does not support types T where sizeof(T) == 0".}
|
||||
cast[ptr T](alloc0(sizeof(T) * size))
|
||||
|
||||
template realloc*(p: pointer, newSize: Natural): pointer =
|
||||
|
||||
Reference in New Issue
Block a user