Skip to content

[expr.add] Harmonize wording for pointer subtraction/std::ptrdiff_t with [expr.sizeof] #8564

@eisenwave

Description

@eisenwave

In [expr.add] paragraph 5 we say:

When two pointer expressions P and Q are subtracted, the type of the result is an implementation-defined signed integral type; this type shall be the same type that is named by std​::​ptrdiff_t in the <cstddef> header ([support.types.layout]).

This is very clunky and verbose compared to [expr.sizeof] paragraph 5

The result of sizeof and sizeof... is a prvalue of type std​::​size_t.

In the rest of core wording, we don't usually shy away from talking about std::float32_t and std::size_t in a more direct way, rather than using all this "the same type that is named by ..." fluff.

We could presumably just say that the result is a prvalue of type std::ptrdiff_t with a cross-reference, and call it a day.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3-OtherTriaged issue not in P1 or P2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions