Skip to content

Clarify (un)signed-ness of pointers for comparisons #77497

Closed
@gamozolabs

Description

@gamozolabs

It seems currently pointer comparisons, ala. (foo as *const u32) > (bar as *const u32). Emits an unsigned comparison. I looked a little bit to see if this was documented somewhere and I didn't see anything super obvious.

Is this something that is defined behavior, and if it is, could we clarify it in the primitive pointer type documentation? This can be relevant especially in many kernel designs when there are "negative" addresses in the kernel and "positive" in user-space.

Thanks!
-B

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-raw-pointersArea: raw pointers, MaybeUninit, NonNullC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions