Skip to content

Clarify UnsafeMutablePointer.pointee docs for assignment #68030

Open
@karwa

Description

@karwa

Description

Currently, the documentation for UMP.pointee (link) says:

When reading from the pointee property, the instance referenced by this pointer must already be initialized. When pointee is used as the left side of an assignment, the instance is updated. The instance must be initialized or this pointer’s Pointee type must be a trivial type.

It is not clear that the final sentence applies to assignment only, so it could be seen as suggesting that it is okay to read trivial types from memory that is not initialised.

See https://forums.swift.org/t/uninitialized-memory-trivial-types/66849/4 for more context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions