Skip to content

Commit 24e0be2

Browse files
committed
P0533R9 constexpr for <cmath> and <cstdlib>
1 parent 4b1a735 commit 24e0be2

File tree

5 files changed

+232
-197
lines changed

5 files changed

+232
-197
lines changed

source/expressions.tex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7362,7 +7362,11 @@
73627362
an \grammarterm{asm-declaration}\iref{dcl.asm};
73637363

73647364
\item
7365-
an invocation of the \tcode{va_arg} macro\iref{cstdarg.syn}; or
7365+
an invocation of the \tcode{va_arg} macro\iref{cstdarg.syn};
7366+
7367+
\item
7368+
a non-constant library call\iref{defns.nonconst.libcall};
7369+
or
73667370

73677371
\item
73687372
a \keyword{goto} statement\iref{stmt.goto}.

source/intro.tex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,12 @@
423423
sequence of one or more bytes representing
424424
the code unit sequence for an encoded character of the execution character set
425425

426+
\indexdefn{library call!non-constant}%
427+
\definition{non-constant library call}{defns.nonconst.libcall}
428+
invocation of a library function that,
429+
as part of evaluating any expression \tcode{E},
430+
prevents \tcode{E} from being a core constant expression
431+
426432
\definition{NTCTS}{defns.ntcts}
427433
\defncontext{library}
428434
\indexdefn{NTCTS}%

source/lib-intro.tex

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,30 @@
136136
ISO C \tcode{restrict} qualifier)
137137
are the same unless otherwise stated.
138138

139+
\pnum
140+
A call to a C standard library function is
141+
a non-constant library call\iref{defns.nonconst.libcall}
142+
if it raises a floating-point exception other than \tcode{FE_INEXACT}.
143+
The semantics of a call to a C standard library function
144+
evaluated as a core constant expression
145+
are those specified in Annex F of the C standard
146+
\begin{footnote}
147+
See also ISO/IEC 9899:2018 section 7.6.
148+
\end{footnote}
149+
to the extent applicable to the floating-point types\iref{basic.fundamental}
150+
that are parameter types of the called function.
151+
\begin{note}
152+
Annex F specifies
153+
the conditions under which floating-point exceptions are raised and
154+
the behavior when NaNs and/or infinities are passed as arguments.
155+
\end{note}
156+
\begin{note}
157+
Equivalently, a call to a C standard library function is
158+
a non-constant library call
159+
if \tcode{errno} is set
160+
when math \tcode{errhandling \& MATH ERRNO} is \tcode{true}.
161+
\end{note}
162+
139163
\rSec1[description]{Method of description}
140164

141165
\rSec2[description.general]{General}

0 commit comments

Comments
 (0)