Skip to content

Commit 0e6dc2e

Browse files
committedMar 5, 2020
Consistent null pointer value usage
1 parent c7f12d2 commit 0e6dc2e

File tree

8 files changed

+144
-143
lines changed

8 files changed

+144
-143
lines changed
 

‎source/basic.tex

+3-3
Original file line numberDiff line numberDiff line change
@@ -3954,7 +3954,7 @@
39543954
Even if the size of the space
39553955
requested is zero, the request can fail. If the request succeeds, the
39563956
value returned by a replaceable allocation function
3957-
is a non-null pointer value\iref{conv.ptr}
3957+
is a non-null pointer value\iref{basic.compound}
39583958
\tcode{p0} different from any previously returned value \tcode{p1},
39593959
unless that value \tcode{p1} was subsequently passed to a
39603960
replaceable deallocation function.
@@ -3967,7 +3967,7 @@
39673967
to have \tcode{operator new()} implementable by
39683968
calling \tcode{std::malloc()} or \tcode{std::calloc()}, so the rules are
39693969
substantially the same. \Cpp{} differs from C in requiring a zero request
3970-
to return a non-null pointer.}
3970+
to return a non-null pointer value.}
39713971

39723972
\pnum
39733973
For an allocation function other than
@@ -4087,7 +4087,7 @@
40874087

40884088
\pnum
40894089
If the argument given to a deallocation function in the standard library
4090-
is a pointer that is not the null pointer value\iref{conv.ptr}, the
4090+
is a pointer that is not a null pointer value\iref{conv.ptr}, the
40914091
deallocation function shall deallocate the storage referenced by the
40924092
pointer, ending the duration of the region of storage.
40934093

‎source/expressions.tex

+11-11
Original file line numberDiff line numberDiff line change
@@ -3492,7 +3492,7 @@
34923492
void h() {
34933493
F f;
34943494
A* ap = &f; // succeeds: finds unique \tcode{A}
3495-
D* dp = dynamic_cast<D*>(ap); // fails: yields null; \tcode{f} has two \tcode{D} subobjects
3495+
D* dp = dynamic_cast<D*>(ap); // fails: yields a null pointer value; \tcode{f} has two \tcode{D} subobjects
34963496
E* ep = (E*)ap; // error: cast from virtual base
34973497
E* ep1 = dynamic_cast<E*>(ap); // succeeds
34983498
}
@@ -4865,7 +4865,7 @@
48654865
\item
48664866
if the allocation function that would have been called
48674867
has a non-throwing exception specification\iref{except.spec},
4868-
the value of the \grammarterm{new-expression}
4868+
the result of the \grammarterm{new-expression}
48694869
is the null pointer value of the required result type;
48704870
\item
48714871
otherwise, the \grammarterm{new-expression} terminates by throwing an
@@ -5093,22 +5093,22 @@
50935093
\indexlibraryglobal{bad_alloc}%
50945094
\tcode{std::bad_alloc} exception~(\ref{basic.stc.dynamic.allocation},
50955095
\ref{except}, \ref{bad.alloc});
5096-
it returns a non-null pointer otherwise. If the allocation function
5096+
it returns a non-null pointer value otherwise. If the allocation function
50975097
has a non-throwing exception specification,
5098-
it returns null to indicate failure to allocate storage
5099-
and a non-null pointer otherwise.
5098+
it returns a null pointer value to indicate failure to allocate storage
5099+
and a non-null pointer value otherwise.
51005100
\end{note}
51015101
If the allocation function is a non-allocating
5102-
form\iref{new.delete.placement} that returns null,
5102+
form\iref{new.delete.placement} that returns a null pointer value,
51035103
the behavior is undefined.
51045104
Otherwise,
5105-
if the allocation function returns null, initialization shall not be
5106-
done, the deallocation function shall not be called, and the value of
5107-
the \grammarterm{new-expression} shall be null.
5105+
if the allocation function returns a null pointer value, initialization shall not be
5106+
done, the deallocation function shall not be called, and the result of
5107+
the \grammarterm{new-expression} shall be a null pointer value.
51085108

51095109
\pnum
51105110
\begin{note}
5111-
When the allocation function returns a value other than null, it must be
5111+
When the allocation function returns a value other than a null pointer value, it must be
51125112
a pointer to a block of storage in which space for the object has been
51135113
reserved. The block of storage is assumed to be appropriately aligned
51145114
and of the requested size. The address of the created object will not
@@ -6125,7 +6125,7 @@
61256125
considered to belong to a single-element array for this purpose.}
61266126
the result of the comparison is unspecified.
61276127
\item
6128-
Otherwise, if the pointers are both null, both point to the same
6128+
Otherwise, if both pointers are null pointer values, both point to the same
61296129
\indextext{address}%
61306130
function, or both represent the same address\iref{basic.compound},
61316131
they compare equal.

‎source/future.tex

+25-25
Original file line numberDiff line numberDiff line change
@@ -549,10 +549,10 @@
549549
has a
550550
\term{seekable area},
551551
delimited by the pointers \tcode{seeklow} and \tcode{seekhigh}.
552-
If \tcode{gnext} is a null pointer, the seekable area is undefined.
552+
If \tcode{gnext} is a null pointer value, the seekable area is undefined.
553553
Otherwise, \tcode{seeklow} equals \tcode{gbeg} and
554554
\tcode{seekhigh} is either \tcode{pend},
555-
if \tcode{pend} is not a null pointer, or \tcode{gend}.
555+
if \tcode{pend} is a non-null pointer value, or \tcode{gend}.
556556

557557
\rSec3[depr.strstreambuf.cons]{\tcode{strstreambuf} constructors}
558558

@@ -571,10 +571,10 @@
571571
\begin{libtab2}{\tcode{strstreambuf(streamsize)} effects}{depr.strstreambuf.cons.sz}
572572
{ll}
573573
{Element}{Value}
574-
\tcode{strmode} & \tcode{dynamic} \\
575-
\tcode{alsize} & \tcode{alsize_arg} \\
576-
\tcode{palloc} & a null pointer \\
577-
\tcode{pfree} & a null pointer \\
574+
\tcode{strmode} & \tcode{dynamic} \\
575+
\tcode{alsize} & \tcode{alsize_arg} \\
576+
\tcode{palloc} & a null pointer value \\
577+
\tcode{pfree} & a null pointer value \\
578578
\end{libtab2}
579579

580580
\indexlibraryctor{strstreambuf}%
@@ -621,8 +621,8 @@
621621
{Element}{Value}
622622
\tcode{strmode} & 0 \\
623623
\tcode{alsize} & an unspecified value \\
624-
\tcode{palloc} & a null pointer \\
625-
\tcode{pfree} & a null pointer \\
624+
\tcode{palloc} & a null pointer value \\
625+
\tcode{pfree} & a null pointer value \\
626626
\end{libtab2}
627627

628628
\pnum
@@ -651,7 +651,7 @@
651651
\end{itemize}
652652

653653
\pnum
654-
If \tcode{pbeg_arg} is a null pointer, the function executes:
654+
If \tcode{pbeg_arg} is a null pointer value, the function executes:
655655

656656
\begin{codeblock}
657657
setg(gnext_arg, gnext_arg, gnext_arg + N);
@@ -734,7 +734,7 @@
734734

735735
\pnum
736736
\remarks
737-
The return value can be a null pointer.
737+
The return value can be a null pointer value.
738738
\end{itemdescr}
739739

740740
\indexlibrarymember{pcount}{strstreambuf}%
@@ -746,7 +746,7 @@
746746
\pnum
747747
\effects
748748
If the next pointer for the output sequence, \tcode{pnext}, is
749-
a null pointer, returns zero.
749+
a null pointer value, returns zero.
750750
Otherwise, returns the current
751751
effective length of the array object as the next pointer minus the beginning
752752
pointer for the output sequence, \tcode{pnext - pbeg}.
@@ -806,7 +806,7 @@
806806
\indextext{unspecified}%
807807
\footnote{An implementation should consider \tcode{alsize} in making this
808808
decision.}
809-
If \tcode{palloc} is not a null pointer, the function calls
809+
If \tcode{palloc} is a non-null pointer value, the function calls
810810
\tcode{(*palloc)(n)}
811811
to allocate the new dynamic array object.
812812
Otherwise, it evaluates the expression
@@ -818,7 +818,7 @@
818818
\pnum
819819
To free a previously existing dynamic array object whose first
820820
element address is \tcode{p}:
821-
If \tcode{pfree} is not a null pointer,
821+
If \tcode{pfree} is a non-null pointer value,
822822
the function calls
823823
\tcode{(*pfree)(p)}.
824824
Otherwise, it evaluates the expression \tcode{delete[]p}.
@@ -905,7 +905,7 @@
905905
\tcode{(unsigned char)\brk*gnext}.
906906
\item
907907
Otherwise, if
908-
the current write next pointer \tcode{pnext} is not a null pointer and
908+
the current write next pointer \tcode{pnext} is a non-null pointer value and
909909
is greater than the current read end pointer \tcode{gend},
910910
makes a
911911
\term{read position}
@@ -955,7 +955,7 @@
955955
\end{libtab2}
956956

957957
\pnum
958-
For a sequence to be positioned, if its next pointer is a null pointer,
958+
For a sequence to be positioned, if its next pointer is a null pointer value,
959959
the positioning operation fails.
960960
Otherwise, the function determines \tcode{newoff} as indicated in
961961
\tref{depr.strstreambuf.seekoff.newoff}.
@@ -1018,7 +1018,7 @@
10181018
\end{itemize}
10191019

10201020
\pnum
1021-
For a sequence to be positioned, if its next pointer is a null pointer,
1021+
For a sequence to be positioned, if its next pointer is a null pointer value,
10221022
the positioning operation fails.
10231023
Otherwise, the function determines \tcode{newoff} from
10241024
\tcode{sp.offset()}:
@@ -1727,7 +1727,7 @@
17271727

17281728
\begin{itemdescr}
17291729
\pnum
1730-
\requires \tcode{p} shall not be null.
1730+
\requires \tcode{p} shall be a non-null pointer value.
17311731

17321732
\pnum
17331733
\returns
@@ -1745,7 +1745,7 @@
17451745

17461746
\begin{itemdescr}
17471747
\pnum
1748-
\requires \tcode{p} shall not be null.
1748+
\requires \tcode{p} shall be a non-null pointer value.
17491749

17501750
\pnum
17511751
\returns
@@ -1763,7 +1763,7 @@
17631763

17641764
\begin{itemdescr}
17651765
\pnum
1766-
\requires \tcode{p} shall not be null.
1766+
\requires \tcode{p} shall be a non-null pointer value.
17671767

17681768
\pnum
17691769
\requires \tcode{mo} shall not be \tcode{memory_order_release} or \tcode{memory_order_acq_rel}.
@@ -1784,7 +1784,7 @@
17841784

17851785
\begin{itemdescr}
17861786
\pnum
1787-
\requires \tcode{p} shall not be null.
1787+
\requires \tcode{p} shall be a non-null pointer value.
17881788

17891789
\pnum
17901790
\effects
@@ -1802,7 +1802,7 @@
18021802

18031803
\begin{itemdescr}
18041804
\pnum
1805-
\requires \tcode{p} shall not be null.
1805+
\requires \tcode{p} shall be a non-null pointer value.
18061806

18071807
\pnum
18081808
\requires \tcode{mo} shall not be \tcode{memory_order_acquire} or \tcode{memory_order_acq_rel}.
@@ -1823,7 +1823,7 @@
18231823

18241824
\begin{itemdescr}
18251825
\pnum
1826-
\requires \tcode{p} shall not be null.
1826+
\requires \tcode{p} shall be a non-null pointer value
18271827

18281828
\pnum
18291829
\returns
@@ -1842,7 +1842,7 @@
18421842

18431843
\begin{itemdescr}
18441844
\pnum
1845-
\requires \tcode{p} shall not be null.
1845+
\requires \tcode{p} shall be a non-null pointer value.
18461846

18471847
\pnum
18481848
\effects
@@ -1865,7 +1865,7 @@
18651865

18661866
\begin{itemdescr}
18671867
\pnum
1868-
\requires \tcode{p} shall not be null and \tcode{v} shall not be null.
1868+
\requires \tcode{p} and \tcode{v} shall be non-null pointer values.
18691869

18701870
\pnum
18711871
\returns
@@ -1907,7 +1907,7 @@
19071907

19081908
\begin{itemdescr}
19091909
\pnum
1910-
\requires \tcode{p} shall not be null and \tcode{v} shall not be null.
1910+
\requires \tcode{p} and \tcode{v} shall be non-null pointer values.
19111911
The \tcode{failure} argument shall not be \tcode{memory_order_release} nor
19121912
\tcode{memory_order_acq_rel}.
19131913

0 commit comments

Comments
 (0)