Skip to content

Commit

Permalink
Last tiny fixes for autumn 24 session of the course
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Ponce committed Oct 13, 2023
1 parent bc7e723 commit b2b601c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions talk/concurrency/mutexes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,15 @@
\frametitlecpp[17]{Mutexes and Locks}
\begin{goodpractice}{Locking}
\begin{itemize}
\item Generally, use \cppinline{std::scoped_lock}. Before \cpp17 use \cppinline{std::lock_guard}.
\item Hold as short as possible, consider wrapping critical section in block statement \cppinline|{ }|
\item Only if manual control needed, use \cppinline{std::unique_lock}
\item Generally, use \cppinline{std::scoped_lock}
\begin{itemize}
\item Before \cpp17 use \cppinline{std::lock_guard}.
\end{itemize}
\item Hold as short as possible
\begin{itemize}
\item Consider wrapping critical section in block statement \cppinline|{ }|
\end{itemize}
\item Only if manual control needed, use \cppinline{std::unique_lock}
\end{itemize}
\end{goodpractice}
\begin{exampleblock}{}
Expand Down
5 changes: 3 additions & 2 deletions talk/expert/modules.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\item Modules allow for sharing declarations and definitions across translation units
\item Header files do the same, but modules have benefits:
\begin{itemize}
\item Better isolation. No cross-talk between multiple pieces of included code, and also not between included code and your code.
\item Better isolation. No cross-talk between multiple pieces of included code, or between included code and your code.
\item Better control over public interface of your library. Avoid leaking library dependencies into user code.
\item Faster compilation (\href{https://youtu.be/DJTEUFRslbI?si=ZRvH1wx0sVJVriLh&t=3259}{import fmt; \textgreater1500x faster})
\end{itemize}
Expand Down Expand Up @@ -350,7 +350,8 @@
\begin{itemize}
\item Use \cppinline|import std;| for the entire C++ standard library. Basically everything in namespace \cppinline|std|.
\begin{itemize}
\item E.g.\ \cppinline{memcpy(a, b, n)}, \cppinline{sqrt(val)}, \cppinline{uint32_t i} will not compile. You need to prefix \cppinline{std::}.
\item E.g.\ \cppinline{memcpy(a, b, n)}, \cppinline{sqrt(val)}, \cppinline{uint32_t}
\item Note that you need to prefix with \cppinline{std::}
\end{itemize}
\item Use \cppinline|import std.compat;| for the entire C and C++ standard library
\item No macros are exported. For these, you still need to include the corresponding headers.
Expand Down

0 comments on commit b2b601c

Please sign in to comment.