Skip to content

Commit 3c78cda

Browse files
rousonbonachea
authored andcommitted
doc(example/README): describe invoke-via-macro
1 parent bd81c7f commit 3c78cda

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

example/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
Examples
22
========
33

4-
This directory contains two example programs.
4+
This directory contains several example programs.
5+
6+
Example of recommended use
7+
--------------------------
8+
The [invoke-via-macro.F90] example demonstrates the recommended ways
9+
to write assertions in code. These leverage the function-like macros
10+
`call_assert` and `call_assert_describe`. The primary advantage of
11+
using these macros is that they are completely eliminated when a file
12+
is compiled with the `ASSERTIONS` macro undefined or defined as `0`.
13+
To run this example with assertions off, use the command
14+
```
15+
fpm run --example invoke-via-macro
16+
```
17+
To run the example with assertions on, use either of the following
18+
commands:
19+
```
20+
fpm run --example invoke-via-macro --flag "-DASSERTIONS"
21+
```
522

623
Simple examples
724
---------------
@@ -39,6 +56,7 @@ or more images providing stop codes analogous to those quoted in the [Single-ima
3956
[Enforcing programming contracts]: #enforcing-programming-contracts
4057
[Single-image execution]: #single-image-execution
4158
[simple_assertions.f90]: ./simple_assertions.f90
59+
[invoke-via-macro.F90]: ./invoke-via-macro.F90
4260
[UML]: https://en.wikipedia.org/wiki/Unified_Modeling_Language
4361
[OCL]: https://en.wikipedia.org/wiki/Object_Constraint_Language
4462
[Atom]: https://atom.io

0 commit comments

Comments
 (0)