Skip to content

[ub] Fix some formatting #7828

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: 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
12 changes: 6 additions & 6 deletions source/ub.tex
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
};

X* make_x() {
// The call to std::malloc can not implicitly create an object of type X
// because X is not an implicit-lifetime class.
// The call to \tcode{std::malloc} can not implicitly create an object of type \tcode{X}
// because \tcode{X} is not an implicit-lifetime class.
X* p = (X*)std::malloc(sizeof(struct X));
p->a = 1; // undefined behavior, no set of objects give us defined behavior
return p;
Expand Down Expand Up @@ -289,7 +289,7 @@

\pnum
\ubxref{basic.start.main.exit.during.destruction} \\
If std::exit is called to
If \tcode{std::exit} is called to
end a program during the destruction of an object with static or thread storage duration, the program has
undefined behavior.

Expand All @@ -305,7 +305,7 @@
Exiter ex; //

int main() {}
// Undefined behavior when destructor of static variable ex is called it will call std::exit
// undefined behavior when destructor of static variable \tcode{ex} is called it will call \tcode{std::exit}
\end{codeblock}
\end{example}

Expand Down Expand Up @@ -339,8 +339,8 @@
B b;

int main() {}
// Undefined behavior, static objects are destructed in reverse order, in this case a then b and
// finally c. When the destructor of c is call it calls f() which passes through definition of
// undefined behavior, static objects are destructed in reverse order, in this case \tcode{a} then \tcode{b} and
// finally \tcode{c}. When the destructor of \tcode{c} is called, it calls \tcode{f()} which passes through the definition of
// previously destroyed block-scope object
\end{codeblock}
\end{example}
Expand Down