Skip to content

Commit e9a99f1

Browse files
committed
mention static asserts
1 parent b4db95d commit e9a99f1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

intro.tex

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@
17331733
\end{slide}
17341734

17351735
\begin{itemize}
1736-
\item The \emph{header file} is a file that contains declarations
1736+
\item The \emph{header file} is a file that contains declarations
17371737
(\emph{forward declaration}) of functions, variables and macro definitions.
17381738
From the preprocessor's point of view, this is a simple file in the C language.
17391739
\item \emsl{These header files are not specific to UNIX. They are part of
@@ -1763,7 +1763,7 @@
17631763
using the \texttt{NDEBUG} define. Example: \example{assert/assert.c}.
17641764

17651765
\begin{verbatim}
1766-
cat assert.c
1766+
cat assert.c
17671767
#include <assert.h>
17681768
17691769
int
@@ -1772,15 +1772,18 @@
17721772
assert(1 == 0);
17731773
return (13);
17741774
}
1775-
$ cc assert.c
1776-
$ ./a.out
1775+
$ cc assert.c
1776+
$ ./a.out
17771777
Assertion failed: 1 == 0, file assert.c, line 6
17781778
Abort (core dumped)
1779-
$ cc -DNDEBUG assert.c
1780-
$ ./a.out
1779+
$ cc -DNDEBUG assert.c
1780+
$ ./a.out
17811781
$ echo $?
17821782
13
17831783
\end{verbatim}
1784+
\item Next to runtime asserts it is also possible to use static asserts
1785+
which are evaluated during compilation. These are handy e.g. for verification of
1786+
expected structure size/offsets.
17841787
\end{itemize}
17851788

17861789

0 commit comments

Comments
 (0)