From b5cfc39c1e3d905c5698d2c1cc869958ea6ff4d1 Mon Sep 17 00:00:00 2001 From: Francesco Giacomini <giaco at cnaf dot infn dot it> Date: Sun, 22 Oct 2017 22:19:45 +0200 Subject: [PATCH] final touches --- cpp-esc17.tex | 2 +- frames.tex | 47 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/cpp-esc17.tex b/cpp-esc17.tex index 09c2dae..4b266d8 100644 --- a/cpp-esc17.tex +++ b/cpp-esc17.tex @@ -62,7 +62,7 @@ \institute{INFN-CNAF} -\date{ESC'17 -- Bertinoro, 23-28 October 2017} +\date{ESC'17 -- Bertinoro, 22-28 October 2017} %\date[Short Occasion] % (optional) %{Date / Occasion} diff --git a/frames.tex b/frames.tex index 73bbb23..c0e0815 100644 --- a/frames.tex +++ b/frames.tex @@ -81,15 +81,6 @@ \end{itemize} \end{frame} -\begin{frame}{Hands-on} - \begin{itemize} - \item Learn how to format automatically your code with clang-format - \item C++ and Memory $\rightarrow$ Format - \item Format \code{hello.cpp} using the default settings - \item Create a configuration file and play with the settings - \end{itemize} -\end{frame} - \section{Type deduction} \begin{frame}[fragile]{\texttt{auto}} @@ -874,7 +865,7 @@ $ ./a.out \begin{frame}{Hands-on} \begin{itemize} - \item C++ and Memory $\rightarrow$ Pointers + \item C++ and Memory $\rightarrow$ Memory issues \item Compile, run directly and run through valgrind and/or ASan \begin{itemize} \item \code{non\_owning\_pointer.cpp} @@ -1186,8 +1177,11 @@ auto s = std::shared\_ptr<FILE>\{ \begin{frame}{Hands-on} \begin{itemize} \item Try the code snippets - \item C++ and Memory $\rightarrow$ Pointers - \item Adapt the previous exercises to use smart pointers + \item C++ and Memory $\rightarrow$ Memory issues + \begin{itemize} + \item Adapt the exercises to use smart pointers + \end{itemize} + \item C++ and Memory $\rightarrow$ Smart pointers \item Starting from \code{dir.cpp}, write code to: \begin{itemize} \item create a smart pointer managing a \code{DIR} resource obtained with @@ -1205,7 +1199,7 @@ auto s = std::shared\_ptr<FILE>\{ \section{Move semantics} -\begin{frame}[fragile]{Copy vs move} +\begin{frame}[fragile]{We can do better than copying} \begin{columns} \begin{column}{.45\textwidth} @@ -1419,7 +1413,7 @@ String \alert<6>{s3}\{\alert<5>{get\_string()}\}\alert<7>{;}}\end{codeblock} \end{frame} -\begin{frame}[fragile]{Copy vs move \insertcontinuationtext} +\begin{frame}[fragile]{Copy vs move} \begin{columns} \begin{column}{.45\textwidth} @@ -2261,3 +2255,28 @@ class Thing \{ \end{itemize} \end{frame} + +\begin{frame}{Hands-on} + + \begin{itemize} + \item C++ and Memory $\rightarrow$ Contracts + \item Identify + \begin{itemize} + \item the invariant of the String class + \item the pre-conditions and the post-condition of its member functions + (when applicable) + \item other logical checkpoints both at compile time and run time + \end{itemize} + \item Express them with \code{static\_assert}s, \code{assert}s and exceptions, + including \code{noexcept} + \item Hint: imagine to remove the default constructor of \code{String} and see + what the consequences are + \end{itemize} + +\end{frame} + +\begin{frame}{Hands-on} + \begin{itemize} + \item C++ and Memory $\rightarrow$ Static analysis + \end{itemize} +\end{frame} -- GitLab