Skip to content

[ub] small fixes to examples #7890

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 2 commits into
base: ub-ifndr
Choose a base branch
from
Open
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
20 changes: 9 additions & 11 deletions source/ub.tex
Original file line number Diff line number Diff line change
Expand Up @@ -790,23 +790,20 @@

\pnum
\begin{example}
If \tcode{float} does not adhere to \IsoFloatUndated{}
and cannot represent positive infinty,
a sufficiently large \tcode{double} value will be
outside the (finite) range of \tcode{float}.
\begin{codeblock}
void f() {
double d = FLT_MAX * 16;
double d = FLT_MAX;
d *= 16;
float f = static_cast<float>(d); // undefined behavior.
}
\end{codeblock}
\end{example}


\pnum
\begin{example}
\begin{codeblock}

\end{codeblock}
\end{example}

\pnum
\ubxref{expr.static.cast.downcast.wrong.derived.type} \\
Down-casting to the wrong derived type is undefined behavior.
Expand Down Expand Up @@ -1347,7 +1344,8 @@
\begin{codeblock}
extern int &ir1;
int i2 = ir1; // undefined behavior, \tcode{ir1} not yet initialized
int ir1 = 17;
int i3 = 17;
int &ir1 = i3;
\end{codeblock}
\end{example}

Expand Down Expand Up @@ -1674,9 +1672,9 @@
}
void f()
{
X& px = &g();
X* px = &g();
px->~X();
int*p = px->i; // undefined behavior
int j = px->i; // undefined behavior
}
\end{codeblock}
\end{example}
Expand Down
Loading