Skip to content

P3348R4 C++26 should refer to C23 not C17 #8011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions source/algorithms.tex
Original file line number Diff line number Diff line change
Expand Up @@ -12006,10 +12006,14 @@
\indexlibraryglobal{bsearch}%
\indexlibraryglobal{qsort}%
\begin{itemdecl}
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
void* bsearch(const void* key, void* base, size_t nmemb, size_t size,
@\placeholder{c-compare-pred}@* compar);
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
void* bsearch(const void* key, void* base, size_t nmemb, size_t size,
@\placeholder{compare-pred}@* compar);
const void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
@\placeholder{c-compare-pred}@* compar);
const void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
@\placeholder{compare-pred}@* compar);
void qsort(void* base, size_t nmemb, size_t size, @\placeholder{c-compare-pred}@* compar);
void qsort(void* base, size_t nmemb, size_t size, @\placeholder{compare-pred}@* compar);
\end{itemdecl}
Expand All @@ -12029,4 +12033,4 @@
Any exception thrown by \tcode{compar}\iref{res.on.exception.handling}.
\end{itemdescr}

\xrefc{7.22.5}
\xrefc{7.24.5}
41 changes: 15 additions & 26 deletions source/compatibility.tex
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,18 @@
\tcode{trivially_relocatable_if_eligible} as macros is invalid
in this revision of \Cpp{}.

\rSec2[diff.cpp23.mem]{\ref{mem}: memory management library}

\diffref{c.malloc}
\change
Calling \tcode{realloc} with a non-null pointer and zero size
has erroneous behavior.
\rationale
The C standard library does not define this behavior.
\effect
Valid \CppXXIII{} code that calls \tcode{realloc}
with a non-null pointer and a size of zero is erroneous and may change behavior.

\rSec2[diff.cpp23.containers]{\ref{containers}: containers library}

\diffref{span.overview}
Expand Down Expand Up @@ -3641,12 +3653,12 @@

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

\rSec3[diff.char16]{Types \tcode{char16_t} and \tcode{char32_t}}
\rSec3[diff.char16]{Types \tcode{char8_t}, \tcode{char16_t}, and \tcode{char32_t}}

\pnum
The types \keyword{char16_t} and \keyword{char32_t}
The types \keyword{char8_t}, \keyword{char16_t}, and \keyword{char32_t}
are distinct types rather than typedefs to existing integral types.
The tokens \keyword{char16_t} and \keyword{char32_t}
The tokens \keyword{char8_t}, \keyword{char16_t}, and \keyword{char32_t}
are keywords in \Cpp{}\iref{lex.key}.
They do not appear as macro or type names defined in
\libheaderref{cuchar}.
Expand All @@ -3663,14 +3675,6 @@
\libheaderref{cstdlib},
or \libheaderref{cwchar}.

\rSec3[diff.header.assert.h]{Header \tcode{<assert.h>}}
\indexhdr{assert.h}%

\pnum
The token \keyword{static_assert} is a keyword in \Cpp{}.
It does not appear as a macro name defined
in \libheaderref{cassert}.

\rSec3[diff.header.iso646.h]{Header \tcode{<iso646.h>}}

\pnum
Expand All @@ -3691,21 +3695,6 @@
and are not introduced as macros
by \libheaderref{iso646.h}.

\rSec3[diff.header.stdalign.h]{Header \tcode{<stdalign.h>}}

\pnum
The token \keyword{alignas} is a keyword in \Cpp{}\iref{lex.key},
and is not introduced as a macro
by \libheaderref{stdalign.h}.

\rSec3[diff.header.stdbool.h]{Header \tcode{<stdbool.h>}}

\pnum
The tokens \keyword{bool}, \keyword{true}, and \keyword{false}
are keywords in \Cpp{}\iref{lex.key},
and are not introduced as macros
by \libheaderref{stdbool.h}.

\rSec3[diff.null]{Macro \tcode{NULL}}

\pnum
Expand Down
36 changes: 33 additions & 3 deletions source/future.tex
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,33 @@
\rSec1[depr.c.macros]{Deprecated C macros}

\pnum
The header \libheaderref{stdalign.h} has the following macros:
The header \libheaderref{cfloat} has the following macros:
\begin{codeblock}
#define @\libxmacro{alignas_is_defined}@ 1
#define @\libxmacro{alignof_is_defined}@ 1
#define @\libmacro{FLT_HAS_SUBNORM}@ @\seebelow@
#define @\libmacro{DBL_HAS_SUBNORM}@ @\seebelow@
#define @\libmacro{LDBL_HAS_SUBNORM}@ @\seebelow@
#define @\libmacro{DECIMAL_DIG}@ @\seebelow@
\end{codeblock}
The header defines these macros the same as
the C standard library header \libheader{float.h}.

\xrefc{5.2.4.2.2, 7.33.5}

\pnum
In addition to being available via inclusion of the \libheader{cfloat} header,
the macros \tcode{INFINITY} and \tcode{NAN} are
available when \libheaderref{cmath} is included.

\xrefc{7.12}

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

\xrefc{7.19}

\rSec1[depr.cerrno]{Deprecated error numbers}

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

\rSec1[depr.ctime]{Deprecated time formatting}

\pnum
The header \libheaderref{ctime} has the following additions:
\begin{codeblock}
char* asctime(const tm* timeptr);
char* ctime(const time_t* timer);
\end{codeblock}

\pnum
The functions \tcode{asctime} and \tcode{ctime}
are not required to avoid data races\iref{res.on.data.races}.

\xrefc{7.29}

\rSec1[depr.fs.path.factory]{Deprecated filesystem path factory functions}

\pnum
Expand Down
36 changes: 32 additions & 4 deletions source/iostreams.tex
Original file line number Diff line number Diff line change
Expand Up @@ -18874,6 +18874,8 @@
\indexlibraryglobal{ferror}%
\indexlibraryglobal{perror}%
\begin{codeblock}
#define __STDC_VERSION_STDIO_H__ 202311L

namespace std {
using size_t = @\textit{see \ref{support.types.layout}}@;
using FILE = @\seebelow@;
Expand All @@ -18888,6 +18890,7 @@
#define @\libmacro{EOF}@ @\seebelow@
#define @\libmacro{FOPEN_MAX}@ @\seebelow@
#define @\libmacro{FILENAME_MAX}@ @\seebelow@
#define @\libmacro{_PRINTF_NAN_LEN_MAX}@ @\seebelow@
#define @\libmacro{L_tmpnam}@ @\seebelow@
#define @\libmacro{SEEK_CUR}@ @\seebelow@
#define @\libmacro{SEEK_END}@ @\seebelow@
Expand Down Expand Up @@ -18982,33 +18985,42 @@
\indexlibraryglobal{PRIuN}%
\indexlibraryglobal{PRIxN}%
\indexlibraryglobal{PRIXN}%
\indexlibraryglobal{PRIbN}%
\indexlibraryglobal{PRIBN}%
\indexlibraryglobal{SCNdN}%
\indexlibraryglobal{SCNiN}%
\indexlibraryglobal{SCNoN}%
\indexlibraryglobal{SCNuN}%
\indexlibraryglobal{SCNxN}%
\indexlibraryglobal{SCNbN}%
\indexlibraryglobal{PRIdLEASTN}%
\indexlibraryglobal{PRIiLEASTN}%
\indexlibraryglobal{PRIoLEASTN}%
\indexlibraryglobal{PRIuLEASTN}%
\indexlibraryglobal{PRIxLEASTN}%
\indexlibraryglobal{PRIXLEASTN}%
\indexlibraryglobal{PRIbLEASTN}%
\indexlibraryglobal{PRIBLEASTN}%
\indexlibraryglobal{SCNdLEASTN}%
\indexlibraryglobal{SCNiLEASTN}%
\indexlibraryglobal{SCNoLEASTN}%
\indexlibraryglobal{SCNuLEASTN}%
\indexlibraryglobal{SCNxLEASTN}%
\indexlibraryglobal{SCNbLEASTN}%
\indexlibraryglobal{PRIdFASTN}%
\indexlibraryglobal{PRIiFASTN}%
\indexlibraryglobal{PRIoFASTN}%
\indexlibraryglobal{PRIuFASTN}%
\indexlibraryglobal{PRIxFASTN}%
\indexlibraryglobal{PRIXFASTN}%
\indexlibraryglobal{PRIbFASTN}%
\indexlibraryglobal{PRIBFASTN}%
\indexlibraryglobal{SCNdFASTN}%
\indexlibraryglobal{SCNiFASTN}%
\indexlibraryglobal{SCNoFASTN}%
\indexlibraryglobal{SCNuFASTN}%
\indexlibraryglobal{SCNxFASTN}%
\indexlibraryglobal{SCNbFASTN}%
\begin{codeblock}
#include <cstdint> // see \ref{cstdint.syn}

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

#define __STDC_VERSION_INTTYPES_H__ 202311L

#define PRId@\placeholdernc{N}@ @\seebelow@
#define PRIi@\placeholdernc{N}@ @\seebelow@
#define PRIo@\placeholdernc{N}@ @\seebelow@
#define PRIu@\placeholdernc{N}@ @\seebelow@
#define PRIx@\placeholdernc{N}@ @\seebelow@
#define PRIX@\placeholdernc{N}@ @\seebelow@
#define PRIb@\placeholdernc{N}@ @\seebelow@
#define PRIB@\placeholdernc{N}@ @\seebelow@
#define SCNd@\placeholdernc{N}@ @\seebelow@
#define SCNi@\placeholdernc{N}@ @\seebelow@
#define SCNo@\placeholdernc{N}@ @\seebelow@
#define SCNu@\placeholdernc{N}@ @\seebelow@
#define SCNx@\placeholdernc{N}@ @\seebelow@
#define SCNb@\placeholdernc{N}@ @\seebelow@
#define PRIdLEAST@\placeholdernc{N}@ @\seebelow@
#define PRIiLEAST@\placeholdernc{N}@ @\seebelow@
#define PRIoLEAST@\placeholdernc{N}@ @\seebelow@
#define PRIuLEAST@\placeholdernc{N}@ @\seebelow@
#define PRIxLEAST@\placeholdernc{N}@ @\seebelow@
#define PRIXLEAST@\placeholdernc{N}@ @\seebelow@
#define PRIbLEAST@\placeholdernc{N}@ @\seebelow@
#define PRIBLEAST@\placeholdernc{N}@ @\seebelow@
#define SCNdLEAST@\placeholdernc{N}@ @\seebelow@
#define SCNiLEAST@\placeholdernc{N}@ @\seebelow@
#define SCNoLEAST@\placeholdernc{N}@ @\seebelow@
#define SCNuLEAST@\placeholdernc{N}@ @\seebelow@
#define SCNxLEAST@\placeholdernc{N}@ @\seebelow@
#define SCNbLEAST@\placeholdernc{N}@ @\seebelow@
#define PRIdFAST@\placeholdernc{N}@ @\seebelow@
#define PRIiFAST@\placeholdernc{N}@ @\seebelow@
#define PRIoFAST@\placeholdernc{N}@ @\seebelow@
#define PRIuFAST@\placeholdernc{N}@ @\seebelow@
#define PRIxFAST@\placeholdernc{N}@ @\seebelow@
#define PRIXFAST@\placeholdernc{N}@ @\seebelow@
#define PRIbFAST@\placeholdernc{N}@ @\seebelow@
#define PRIBFAST@\placeholdernc{N}@ @\seebelow@
#define SCNdFAST@\placeholdernc{N}@ @\seebelow@
#define SCNiFAST@\placeholdernc{N}@ @\seebelow@
#define SCNoFAST@\placeholdernc{N}@ @\seebelow@
#define SCNuFAST@\placeholdernc{N}@ @\seebelow@
#define SCNxFAST@\placeholdernc{N}@ @\seebelow@
#define SCNbFAST@\placeholdernc{N}@ @\seebelow@
#define @\libmacro{PRIdMAX}@ @\seebelow@
#define @\libmacro{PRIiMAX}@ @\seebelow@
#define @\libmacro{PRIoMAX}@ @\seebelow@
#define @\libmacro{PRIuMAX}@ @\seebelow@
#define @\libmacro{PRIxMAX}@ @\seebelow@
#define @\libmacro{PRIXMAX}@ @\seebelow@
#define @\libmacro{PRIbMAX}@ @\seebelow@
#define @\libmacro{PRIBMAX}@ @\seebelow@
#define @\libmacro{SCNdMAX}@ @\seebelow@
#define @\libmacro{SCNiMAX}@ @\seebelow@
#define @\libmacro{SCNoMAX}@ @\seebelow@
#define @\libmacro{SCNuMAX}@ @\seebelow@
#define @\libmacro{SCNxMAX}@ @\seebelow@
#define @\libmacro{SCNbMAX}@ @\seebelow@
#define @\libmacro{PRIdPTR}@ @\seebelow@
#define @\libmacro{PRIiPTR}@ @\seebelow@
#define @\libmacro{PRIoPTR}@ @\seebelow@
#define @\libmacro{PRIuPTR}@ @\seebelow@
#define @\libmacro{PRIxPTR}@ @\seebelow@
#define @\libmacro{PRIXPTR}@ @\seebelow@
#define @\libmacro{PRIbPTR}@ @\seebelow@
#define @\libmacro{PRIBPTR}@ @\seebelow@
#define @\libmacro{SCNdPTR}@ @\seebelow@
#define @\libmacro{SCNiPTR}@ @\seebelow@
#define @\libmacro{SCNoPTR}@ @\seebelow@
#define @\libmacro{SCNuPTR}@ @\seebelow@
#define @\libmacro{SCNxPTR}@ @\seebelow@
#define @\libmacro{SCNbPTR}@ @\seebelow@
\end{codeblock}

\pnum
Expand All @@ -19092,10 +19121,6 @@
The header \libheader{cinttypes} includes the header \libheaderref{cstdint} instead
of \libheader{stdint.h}, and
\item
\tcode{intmax_t} and \tcode{uintmax_t} are not required
to be able to represent all values of extended integer types
wider than \tcode{long long} and \tcode{unsigned long long}, respectively, and
\item
if and only if the type \tcode{intmax_t} designates an extended integer
type\iref{basic.fundamental}, the following function signatures are added:
\begin{codeblock}
Expand All @@ -19117,3 +19142,6 @@
is defined if and only if the implementation
defines the corresponding \grammarterm{typedef-name} in~\ref{cstdint.syn} and
has a suitable \tcode{fscanf} length modifier for the type.
Each of the \tcode{PRIB} macros listed in this subclause
is defined if and only if \tcode{fprintf} supports
the \tcode{B} conversion specifier.
2 changes: 1 addition & 1 deletion source/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
\newcommand{\CppXXIII}{\Cpp{} 2023}
\newcommand{\CppXXVI}{\Cpp{} 2026}
\newcommand{\IsoCUndated}{ISO/IEC 9899}
\newcommand{\IsoC}{\IsoCUndated{}:2018}
\newcommand{\IsoC}{\IsoCUndated{}:2024}
\newcommand{\IsoFloatUndated}{ISO/IEC 60559}
\newcommand{\IsoPosixUndated}{ISO/IEC/IEEE 9945}
\newcommand{\IsoPosix}{\IsoPosixUndated{}:2009}
Expand Down
33 changes: 29 additions & 4 deletions source/memory.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2022,12 +2022,10 @@
\indexlibraryglobal{aligned_alloc}%
\indexlibraryglobal{calloc}%
\indexlibraryglobal{malloc}%
\indexlibraryglobal{realloc}%
\begin{itemdecl}
void* aligned_alloc(size_t alignment, size_t size);
void* calloc(size_t nmemb, size_t size);
void* malloc(size_t size);
void* realloc(void* ptr, size_t size);
\end{itemdecl}

\begin{itemdescr}
Expand All @@ -2045,8 +2043,35 @@
These functions implicitly create objects\iref{intro.object}
in the returned region of storage and
return a pointer to a suitable created object.
In the case of \tcode{calloc} and \tcode{realloc},
the objects are created before the storage is zeroed or copied, respectively.
In the case of \tcode{calloc},
the objects are created before the storage is zeroed.
\end{itemdescr}

\indexlibraryglobal{realloc}%
\begin{itemdecl}
void* realloc(void* ptr, size_t size)
\end{itemdecl}

\begin{itemdescr}
\pnum
\expects
\tcode{free(ptr)} has well-defined behavior.

\pnum
\effects
If \tcode{ptr} is not null and \tcode{size} is zero,
the behavior is erroneous and the effects are implementation-defined.
Otherwise, this function has the semantics specified in the C standard library.

\pnum
\remarks
This function does not attempt to allocate storage
by calling \tcode{::operator new()}\iref{new.delete}.
When a non-null pointer is returned,
this function implicitly creates objects\iref{intro.object}
in the returned region of storage and
returns a pointer to a suitable created object.
The objects are created before the storage is copied.
\end{itemdescr}

\indexlibraryglobal{free}%
Expand Down
Loading