Skip to content

Commit 3076f40

Browse files
amadiobernhardmgruber
authored andcommitted
Update wording in Pointers vs References slide
Make bullet points of pointers and references more easily comparable with each other.
1 parent 5c2374b commit 3076f40

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

talk/basicconcepts/references.tex

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,22 @@
3030
\begin{block}{Specificities of reference}
3131
\begin{itemize}
3232
\item Natural syntax
33-
\item Must be assigned when defined, cannot be \mintinline{cpp}{nullptr}
34-
\item Cannot be reassigned
35-
\item Non-const references to temporary objects are not allowed
33+
\item Cannot be \mintinline{cpp}{nullptr}
34+
\item Must be assigned when defined, cannot be reassigned
35+
\item References to temporary objects must be \mintinline{cpp}{const}
3636
\end{itemize}
3737
\end{block}
3838
\begin{block}{Advantages of pointers}
3939
\begin{itemize}
40-
\item Can be reassigned to point elsewhere or to \mintinline{cpp}{nullptr}
41-
\item Clearly indicates that argument may be modified
40+
\item Can be \mintinline{cpp}{nullptr}
41+
\item Can be initialized after declaration, can be reassigned
4242
\end{itemize}
4343
\end{block}
4444
\pause
4545
\begin{goodpractice}{References}
4646
\begin{itemize}
47-
\item Always use references when you can
48-
\item Consider that a referenced object can be modified
49-
\item Use \mintinline{cpp}{const} when it's not the case
47+
\item Prefer using references instead of pointers
48+
\item Mark references \mintinline{cpp}{const} to prevent modification
5049
\end{itemize}
5150
\end{goodpractice}
5251
\end{frame}

0 commit comments

Comments
 (0)