Skip to content

Commit 73448ea

Browse files
committed
P3348R4 C++26 should refer to C23 not C17
Avoid lone subclause [depr.ctime] in Annex D.
1 parent 2e12f5e commit 73448ea

File tree

12 files changed

+357
-358
lines changed

12 files changed

+357
-358
lines changed

source/algorithms.tex

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12006,10 +12006,14 @@
1200612006
\indexlibraryglobal{bsearch}%
1200712007
\indexlibraryglobal{qsort}%
1200812008
\begin{itemdecl}
12009-
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
12009+
void* bsearch(const void* key, void* base, size_t nmemb, size_t size,
1201012010
@\placeholder{c-compare-pred}@* compar);
12011-
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
12011+
void* bsearch(const void* key, void* base, size_t nmemb, size_t size,
1201212012
@\placeholder{compare-pred}@* compar);
12013+
const void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
12014+
@\placeholder{c-compare-pred}@* compar);
12015+
const void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
12016+
@\placeholder{compare-pred}@* compar);
1201312017
void qsort(void* base, size_t nmemb, size_t size, @\placeholder{c-compare-pred}@* compar);
1201412018
void qsort(void* base, size_t nmemb, size_t size, @\placeholder{compare-pred}@* compar);
1201512019
\end{itemdecl}
@@ -12029,4 +12033,4 @@
1202912033
Any exception thrown by \tcode{compar}\iref{res.on.exception.handling}.
1203012034
\end{itemdescr}
1203112035

12032-
\xrefc{7.22.5}
12036+
\xrefc{7.24.5}

source/compatibility.tex

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,18 @@
240240
\tcode{trivially_relocatable_if_eligible} as macros is invalid
241241
in this revision of \Cpp{}.
242242

243+
\rSec2[diff.cpp23.mem]{\ref{mem}: memory management library}
244+
245+
\diffref{c.malloc}
246+
\change
247+
Calling \tcode{realloc} with a non-null pointer and zero size
248+
has erroneous behavior.
249+
\rationale
250+
The C standard library does not define this behavior.
251+
\effect
252+
Valid \CppXXIII{} code that calls \tcode{realloc}
253+
with a non-null pointer and a size of zero is erroneous and may change behavior.
254+
243255
\rSec2[diff.cpp23.containers]{\ref{containers}: containers library}
244256

245257
\diffref{span.overview}
@@ -3641,12 +3653,12 @@
36413653

36423654
\rSec2[diff.mods.to.definitions]{Modifications to definitions}
36433655

3644-
\rSec3[diff.char16]{Types \tcode{char16_t} and \tcode{char32_t}}
3656+
\rSec3[diff.char16]{Types \tcode{char8_t}, \tcode{char16_t}, and \tcode{char32_t}}
36453657

36463658
\pnum
3647-
The types \keyword{char16_t} and \keyword{char32_t}
3659+
The types \keyword{char8_t}, \keyword{char16_t}, and \keyword{char32_t}
36483660
are distinct types rather than typedefs to existing integral types.
3649-
The tokens \keyword{char16_t} and \keyword{char32_t}
3661+
The tokens \keyword{char8_t}, \keyword{char16_t}, and \keyword{char32_t}
36503662
are keywords in \Cpp{}\iref{lex.key}.
36513663
They do not appear as macro or type names defined in
36523664
\libheaderref{cuchar}.
@@ -3663,14 +3675,6 @@
36633675
\libheaderref{cstdlib},
36643676
or \libheaderref{cwchar}.
36653677

3666-
\rSec3[diff.header.assert.h]{Header \tcode{<assert.h>}}
3667-
\indexhdr{assert.h}%
3668-
3669-
\pnum
3670-
The token \keyword{static_assert} is a keyword in \Cpp{}.
3671-
It does not appear as a macro name defined
3672-
in \libheaderref{cassert}.
3673-
36743678
\rSec3[diff.header.iso646.h]{Header \tcode{<iso646.h>}}
36753679

36763680
\pnum
@@ -3691,21 +3695,6 @@
36913695
and are not introduced as macros
36923696
by \libheaderref{iso646.h}.
36933697

3694-
\rSec3[diff.header.stdalign.h]{Header \tcode{<stdalign.h>}}
3695-
3696-
\pnum
3697-
The token \keyword{alignas} is a keyword in \Cpp{}\iref{lex.key},
3698-
and is not introduced as a macro
3699-
by \libheaderref{stdalign.h}.
3700-
3701-
\rSec3[diff.header.stdbool.h]{Header \tcode{<stdbool.h>}}
3702-
3703-
\pnum
3704-
The tokens \keyword{bool}, \keyword{true}, and \keyword{false}
3705-
are keywords in \Cpp{}\iref{lex.key},
3706-
and are not introduced as macros
3707-
by \libheaderref{stdbool.h}.
3708-
37093698
\rSec3[diff.null]{Macro \tcode{NULL}}
37103699

37113700
\pnum

source/future.tex

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,33 @@
220220
\rSec1[depr.c.macros]{Deprecated C macros}
221221

222222
\pnum
223-
The header \libheaderref{stdalign.h} has the following macros:
223+
The header \libheaderref{cfloat} has the following macros:
224224
\begin{codeblock}
225-
#define @\libxmacro{alignas_is_defined}@ 1
226-
#define @\libxmacro{alignof_is_defined}@ 1
225+
#define @\libmacro{FLT_HAS_SUBNORM}@ @\seebelow@
226+
#define @\libmacro{DBL_HAS_SUBNORM}@ @\seebelow@
227+
#define @\libmacro{LDBL_HAS_SUBNORM}@ @\seebelow@
228+
#define @\libmacro{DECIMAL_DIG}@ @\seebelow@
227229
\end{codeblock}
230+
The header defines these macros the same as
231+
the C standard library header \libheader{float.h}.
232+
233+
\xrefc{5.2.4.2.2, 7.33.5}
234+
235+
\pnum
236+
In addition to being available via inclusion of the \libheader{cfloat} header,
237+
the macros \tcode{INFINITY} and \tcode{NAN} are
238+
available when \libheaderref{cmath} is included.
239+
240+
\xrefc{7.12}
228241

229242
\pnum
230243
The header \libheaderref{stdbool.h} has the following macro:
231244
\begin{codeblock}
232245
#define @\libxmacro{bool_true_false_are_defined}@ 1
233246
\end{codeblock}
234247

248+
\xrefc{7.19}
249+
235250
\rSec1[depr.cerrno]{Deprecated error numbers}
236251

237252
\pnum
@@ -762,6 +777,21 @@
762777
Equivalent to: \tcode{return visit(std::forward<Visitor>(vis), arg.value);}
763778
\end{itemdescr}
764779

780+
\rSec1[depr.ctime]{Deprecated time formatting}
781+
782+
\pnum
783+
The header \libheaderref{ctime} has the following additions:
784+
\begin{codeblock}
785+
char* asctime(const tm* timeptr);
786+
char* ctime(const time_t* timer);
787+
\end{codeblock}
788+
789+
\pnum
790+
The functions \tcode{asctime} and \tcode{ctime}
791+
are not required to avoid data races\iref{res.on.data.races}.
792+
793+
\xrefc{7.29}
794+
765795
\rSec1[depr.fs.path.factory]{Deprecated filesystem path factory functions}
766796

767797
\pnum

source/iostreams.tex

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18874,6 +18874,8 @@
1887418874
\indexlibraryglobal{ferror}%
1887518875
\indexlibraryglobal{perror}%
1887618876
\begin{codeblock}
18877+
#define __STDC_VERSION_STDIO_H__ 202311L
18878+
1887718879
namespace std {
1887818880
using size_t = @\textit{see \ref{support.types.layout}}@;
1887918881
using FILE = @\seebelow@;
@@ -18888,6 +18890,7 @@
1888818890
#define @\libmacro{EOF}@ @\seebelow@
1888918891
#define @\libmacro{FOPEN_MAX}@ @\seebelow@
1889018892
#define @\libmacro{FILENAME_MAX}@ @\seebelow@
18893+
#define @\libmacro{_PRINTF_NAN_LEN_MAX}@ @\seebelow@
1889118894
#define @\libmacro{L_tmpnam}@ @\seebelow@
1889218895
#define @\libmacro{SEEK_CUR}@ @\seebelow@
1889318896
#define @\libmacro{SEEK_END}@ @\seebelow@
@@ -18982,33 +18985,42 @@
1898218985
\indexlibraryglobal{PRIuN}%
1898318986
\indexlibraryglobal{PRIxN}%
1898418987
\indexlibraryglobal{PRIXN}%
18988+
\indexlibraryglobal{PRIbN}%
18989+
\indexlibraryglobal{PRIBN}%
1898518990
\indexlibraryglobal{SCNdN}%
1898618991
\indexlibraryglobal{SCNiN}%
1898718992
\indexlibraryglobal{SCNoN}%
1898818993
\indexlibraryglobal{SCNuN}%
1898918994
\indexlibraryglobal{SCNxN}%
18995+
\indexlibraryglobal{SCNbN}%
1899018996
\indexlibraryglobal{PRIdLEASTN}%
1899118997
\indexlibraryglobal{PRIiLEASTN}%
1899218998
\indexlibraryglobal{PRIoLEASTN}%
1899318999
\indexlibraryglobal{PRIuLEASTN}%
1899419000
\indexlibraryglobal{PRIxLEASTN}%
1899519001
\indexlibraryglobal{PRIXLEASTN}%
19002+
\indexlibraryglobal{PRIbLEASTN}%
19003+
\indexlibraryglobal{PRIBLEASTN}%
1899619004
\indexlibraryglobal{SCNdLEASTN}%
1899719005
\indexlibraryglobal{SCNiLEASTN}%
1899819006
\indexlibraryglobal{SCNoLEASTN}%
1899919007
\indexlibraryglobal{SCNuLEASTN}%
1900019008
\indexlibraryglobal{SCNxLEASTN}%
19009+
\indexlibraryglobal{SCNbLEASTN}%
1900119010
\indexlibraryglobal{PRIdFASTN}%
1900219011
\indexlibraryglobal{PRIiFASTN}%
1900319012
\indexlibraryglobal{PRIoFASTN}%
1900419013
\indexlibraryglobal{PRIuFASTN}%
1900519014
\indexlibraryglobal{PRIxFASTN}%
1900619015
\indexlibraryglobal{PRIXFASTN}%
19016+
\indexlibraryglobal{PRIbFASTN}%
19017+
\indexlibraryglobal{PRIBFASTN}%
1900719018
\indexlibraryglobal{SCNdFASTN}%
1900819019
\indexlibraryglobal{SCNiFASTN}%
1900919020
\indexlibraryglobal{SCNoFASTN}%
1901019021
\indexlibraryglobal{SCNuFASTN}%
1901119022
\indexlibraryglobal{SCNxFASTN}%
19023+
\indexlibraryglobal{SCNbFASTN}%
1901219024
\begin{codeblock}
1901319025
#include <cstdint> // see \ref{cstdint.syn}
1901419026

@@ -19026,61 +19038,78 @@
1902619038
constexpr imaxdiv_t div(intmax_t, intmax_t); // optional, see below
1902719039
}
1902819040

19041+
#define __STDC_VERSION_INTTYPES_H__ 202311L
19042+
1902919043
#define PRId@\placeholdernc{N}@ @\seebelow@
1903019044
#define PRIi@\placeholdernc{N}@ @\seebelow@
1903119045
#define PRIo@\placeholdernc{N}@ @\seebelow@
1903219046
#define PRIu@\placeholdernc{N}@ @\seebelow@
1903319047
#define PRIx@\placeholdernc{N}@ @\seebelow@
1903419048
#define PRIX@\placeholdernc{N}@ @\seebelow@
19049+
#define PRIb@\placeholdernc{N}@ @\seebelow@
19050+
#define PRIB@\placeholdernc{N}@ @\seebelow@
1903519051
#define SCNd@\placeholdernc{N}@ @\seebelow@
1903619052
#define SCNi@\placeholdernc{N}@ @\seebelow@
1903719053
#define SCNo@\placeholdernc{N}@ @\seebelow@
1903819054
#define SCNu@\placeholdernc{N}@ @\seebelow@
1903919055
#define SCNx@\placeholdernc{N}@ @\seebelow@
19056+
#define SCNb@\placeholdernc{N}@ @\seebelow@
1904019057
#define PRIdLEAST@\placeholdernc{N}@ @\seebelow@
1904119058
#define PRIiLEAST@\placeholdernc{N}@ @\seebelow@
1904219059
#define PRIoLEAST@\placeholdernc{N}@ @\seebelow@
1904319060
#define PRIuLEAST@\placeholdernc{N}@ @\seebelow@
1904419061
#define PRIxLEAST@\placeholdernc{N}@ @\seebelow@
1904519062
#define PRIXLEAST@\placeholdernc{N}@ @\seebelow@
19063+
#define PRIbLEAST@\placeholdernc{N}@ @\seebelow@
19064+
#define PRIBLEAST@\placeholdernc{N}@ @\seebelow@
1904619065
#define SCNdLEAST@\placeholdernc{N}@ @\seebelow@
1904719066
#define SCNiLEAST@\placeholdernc{N}@ @\seebelow@
1904819067
#define SCNoLEAST@\placeholdernc{N}@ @\seebelow@
1904919068
#define SCNuLEAST@\placeholdernc{N}@ @\seebelow@
1905019069
#define SCNxLEAST@\placeholdernc{N}@ @\seebelow@
19070+
#define SCNbLEAST@\placeholdernc{N}@ @\seebelow@
1905119071
#define PRIdFAST@\placeholdernc{N}@ @\seebelow@
1905219072
#define PRIiFAST@\placeholdernc{N}@ @\seebelow@
1905319073
#define PRIoFAST@\placeholdernc{N}@ @\seebelow@
1905419074
#define PRIuFAST@\placeholdernc{N}@ @\seebelow@
1905519075
#define PRIxFAST@\placeholdernc{N}@ @\seebelow@
1905619076
#define PRIXFAST@\placeholdernc{N}@ @\seebelow@
19077+
#define PRIbFAST@\placeholdernc{N}@ @\seebelow@
19078+
#define PRIBFAST@\placeholdernc{N}@ @\seebelow@
1905719079
#define SCNdFAST@\placeholdernc{N}@ @\seebelow@
1905819080
#define SCNiFAST@\placeholdernc{N}@ @\seebelow@
1905919081
#define SCNoFAST@\placeholdernc{N}@ @\seebelow@
1906019082
#define SCNuFAST@\placeholdernc{N}@ @\seebelow@
1906119083
#define SCNxFAST@\placeholdernc{N}@ @\seebelow@
19084+
#define SCNbFAST@\placeholdernc{N}@ @\seebelow@
1906219085
#define @\libmacro{PRIdMAX}@ @\seebelow@
1906319086
#define @\libmacro{PRIiMAX}@ @\seebelow@
1906419087
#define @\libmacro{PRIoMAX}@ @\seebelow@
1906519088
#define @\libmacro{PRIuMAX}@ @\seebelow@
1906619089
#define @\libmacro{PRIxMAX}@ @\seebelow@
1906719090
#define @\libmacro{PRIXMAX}@ @\seebelow@
19091+
#define @\libmacro{PRIbMAX}@ @\seebelow@
19092+
#define @\libmacro{PRIBMAX}@ @\seebelow@
1906819093
#define @\libmacro{SCNdMAX}@ @\seebelow@
1906919094
#define @\libmacro{SCNiMAX}@ @\seebelow@
1907019095
#define @\libmacro{SCNoMAX}@ @\seebelow@
1907119096
#define @\libmacro{SCNuMAX}@ @\seebelow@
1907219097
#define @\libmacro{SCNxMAX}@ @\seebelow@
19098+
#define @\libmacro{SCNbMAX}@ @\seebelow@
1907319099
#define @\libmacro{PRIdPTR}@ @\seebelow@
1907419100
#define @\libmacro{PRIiPTR}@ @\seebelow@
1907519101
#define @\libmacro{PRIoPTR}@ @\seebelow@
1907619102
#define @\libmacro{PRIuPTR}@ @\seebelow@
1907719103
#define @\libmacro{PRIxPTR}@ @\seebelow@
1907819104
#define @\libmacro{PRIXPTR}@ @\seebelow@
19105+
#define @\libmacro{PRIbPTR}@ @\seebelow@
19106+
#define @\libmacro{PRIBPTR}@ @\seebelow@
1907919107
#define @\libmacro{SCNdPTR}@ @\seebelow@
1908019108
#define @\libmacro{SCNiPTR}@ @\seebelow@
1908119109
#define @\libmacro{SCNoPTR}@ @\seebelow@
1908219110
#define @\libmacro{SCNuPTR}@ @\seebelow@
1908319111
#define @\libmacro{SCNxPTR}@ @\seebelow@
19112+
#define @\libmacro{SCNbPTR}@ @\seebelow@
1908419113
\end{codeblock}
1908519114

1908619115
\pnum
@@ -19092,10 +19121,6 @@
1909219121
The header \libheader{cinttypes} includes the header \libheaderref{cstdint} instead
1909319122
of \libheader{stdint.h}, and
1909419123
\item
19095-
\tcode{intmax_t} and \tcode{uintmax_t} are not required
19096-
to be able to represent all values of extended integer types
19097-
wider than \tcode{long long} and \tcode{unsigned long long}, respectively, and
19098-
\item
1909919124
if and only if the type \tcode{intmax_t} designates an extended integer
1910019125
type\iref{basic.fundamental}, the following function signatures are added:
1910119126
\begin{codeblock}
@@ -19117,3 +19142,6 @@
1911719142
is defined if and only if the implementation
1911819143
defines the corresponding \grammarterm{typedef-name} in~\ref{cstdint.syn} and
1911919144
has a suitable \tcode{fscanf} length modifier for the type.
19145+
Each of the \tcode{PRIB} macros listed in this subclause
19146+
is defined if and only if \tcode{fprintf} supports
19147+
the \tcode{B} conversion specifier.

source/macros.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
\newcommand{\CppXXIII}{\Cpp{} 2023}
293293
\newcommand{\CppXXVI}{\Cpp{} 2026}
294294
\newcommand{\IsoCUndated}{ISO/IEC 9899}
295-
\newcommand{\IsoC}{\IsoCUndated{}:2018}
295+
\newcommand{\IsoC}{\IsoCUndated{}:2024}
296296
\newcommand{\IsoFloatUndated}{ISO/IEC 60559}
297297
\newcommand{\IsoPosixUndated}{ISO/IEC/IEEE 9945}
298298
\newcommand{\IsoPosix}{\IsoPosixUndated{}:2009}

source/memory.tex

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,12 +2022,10 @@
20222022
\indexlibraryglobal{aligned_alloc}%
20232023
\indexlibraryglobal{calloc}%
20242024
\indexlibraryglobal{malloc}%
2025-
\indexlibraryglobal{realloc}%
20262025
\begin{itemdecl}
20272026
void* aligned_alloc(size_t alignment, size_t size);
20282027
void* calloc(size_t nmemb, size_t size);
20292028
void* malloc(size_t size);
2030-
void* realloc(void* ptr, size_t size);
20312029
\end{itemdecl}
20322030

20332031
\begin{itemdescr}
@@ -2045,8 +2043,35 @@
20452043
These functions implicitly create objects\iref{intro.object}
20462044
in the returned region of storage and
20472045
return a pointer to a suitable created object.
2048-
In the case of \tcode{calloc} and \tcode{realloc},
2049-
the objects are created before the storage is zeroed or copied, respectively.
2046+
In the case of \tcode{calloc},
2047+
the objects are created before the storage is zeroed.
2048+
\end{itemdescr}
2049+
2050+
\indexlibraryglobal{realloc}%
2051+
\begin{itemdecl}
2052+
void* realloc(void* ptr, size_t size)
2053+
\end{itemdecl}
2054+
2055+
\begin{itemdescr}
2056+
\pnum
2057+
\expects
2058+
\tcode{free(ptr)} has well-defined behavior.
2059+
2060+
\pnum
2061+
\effects
2062+
If \tcode{ptr} is not null and \tcode{size} is zero,
2063+
the behavior is erroneous and the effects are implementation-defined.
2064+
Otherwise, this function has the semantics specified in the C standard library.
2065+
2066+
\pnum
2067+
\remarks
2068+
This function does not attempt to allocate storage
2069+
by calling \tcode{::operator new()}\iref{new.delete}.
2070+
When a non-null pointer is returned,
2071+
this function implicitly creates objects\iref{intro.object}
2072+
in the returned region of storage and
2073+
returns a pointer to a suitable created object.
2074+
The objects are created before the storage is copied.
20502075
\end{itemdescr}
20512076

20522077
\indexlibraryglobal{free}%

0 commit comments

Comments
 (0)