Skip to content
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

Fix typo "earlier rather than later" #201

Merged
merged 4 commits into from
Dec 9, 2023
Merged
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion background/background.tex
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ \subsection{Asserts}
Here is a quick example with an assert.
Let's say that we are writing code using memcpy.
We would want to put an assert before that checks whether my two memory regions overlap.
If they do overlap, memcpy runs into undefined behavior, so we want to catch that problem than later.
If they do overlap, memcpy runs into undefined behavior, so we want to catch that problem earlier rather than later.
tudorsiminic marked this conversation as resolved.
Show resolved Hide resolved
tudorsiminic marked this conversation as resolved.
Show resolved Hide resolved

\begin{lstlisting}[language=C]
assert(!(src < dest+n && dest < src+n)); //Checks overlap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this be a more understandable assert ? (Also does not have a "not"; it asserts something is true).
assert( src+n < dest || src >= dest + n); // source should finish before the destination or the source starts after the end of destination

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, sounds good to me

tudorsiminic marked this conversation as resolved.
Show resolved Hide resolved
Expand Down