Skip to content

Commit b4ee30a

Browse files
committed
[expr.add] Simplify wording for pointer subtraction
1 parent b1ff1df commit b4ee30a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

source/expressions.tex

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7206,13 +7206,10 @@
72067206
\indextext{\idxcode{ptrdiff_t}}%
72077207
\indextext{comparison!undefined pointer}%
72087208
When two pointer expressions \tcode{P} and \tcode{Q} are subtracted,
7209-
the type of the result is an \impldef{type of \tcode{ptrdiff_t}} signed
7210-
integral type; this type shall be the same type that is named by
7211-
\tcode{std::ptrdiff_t} in the \libheader{cstddef}
7212-
header\iref{support.types.layout}.
7209+
the result is a prvalue of type \tcode{std::ptrdiff_t}.
72137210
\begin{itemize}
72147211
\item If \tcode{P} and \tcode{Q} both evaluate to null pointer values,
7215-
the result is 0.
7212+
the value is 0.
72167213
\item Otherwise, if \tcode{P} and \tcode{Q} point to, respectively,
72177214
array elements $i$ and $j$
72187215
of the same array object \tcode{x},
@@ -7225,6 +7222,10 @@
72257222
\end{note}
72267223
\item Otherwise, the behavior is undefined.
72277224
\end{itemize}
7225+
\begin{note}
7226+
The \grammarterm{typedef-name} \tcode{std::ptrdiff_t} is declared in the standard header
7227+
\libheader{cstddef}\iref{cstddef.syn,support.types.layout}.
7228+
\end{note}
72287229

72297230
\pnum
72307231
For addition or subtraction, if the expressions \tcode{P} or \tcode{Q} have

0 commit comments

Comments
 (0)