IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

unsafe_pointer

Defines UnsafePointer as a backward-compatible name for Pointer.

UnsafePointer is a comptime alias for Pointer, kept for code written before the two pointer types were unified. Prefer Pointer directly in new code; see std.memory.pointer for the type's docstring and its unsafe_ method surface.

comptime values

UnsafePointer

comptime UnsafePointer[mut: Bool, //, T: AnyType, origin: Origin[mut=mut], *, address_space: AddressSpace = AddressSpace.GENERIC] = Pointer[T, origin, address_space=address_space]

An indirect reference to one or more values of T consecutively in memory, and can refer to uninitialized memory.

Deprecated: 'UnsafePointer' is deprecated, use 'Pointer' instead

Parameters

  • mut (Bool): Whether the pointer is mutable.
  • T (AnyType): The type the pointer points to.
  • origin (Origin[mut=mut]): The origin of the memory being addressed.
  • address_space (AddressSpace): The address space of the pointer.