diff --git a/docs/index.html b/docs/index.html index 713f7ce..adc8c4b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1624,33 +1624,33 @@
ra::
tries to detect a many errors as possible at compile time, but some errors, such as mismatch between expressions of runtime shape or out of range indices, aren’t apparent until runtime.
+
Runtime error handling in ra::
is controlled by two macros.
RA_ASSERT(cond, ...)
—
-cond
evaluates to true (in the ra::
namespace) if the check is satisfied. The other arguments are informative.
+check that cond
evaluates to true in the ra::
namespace. The other arguments are informative.
RA_DO_CHECK
—
must have one of the values 0, 1, or 2.
The behavior is as follows. +
They work as follows:
RA_DO_CHECK
is 0, runtime checks are skipped.
-RA_DO_CHECK
is not 0, runtime checks are done:
+RA_DO_CHECK
is not 0, runtime checks are done.
RA_ASSERT
is user defined, then that is used.
- ra::
provides one depending on the value of RA_DO_CHECK
. The two options are 1 (plain assert
) and 2 (prints the informative arguments before aborting). Other values are an error.
+RA_ASSERT
is defined, using RA_ASSERT
.
+ RA_ASSERT
isn’t defined, the method depends on the value of RA_DO_CHECK
. The two options are 1 (plain assert
) and 2 (prints the informative arguments and aborts). Other values are an error.
RA_DO_CHECK
defaults to 2. After including ra/ra.hh
, it will always be defined.
-
ra::
contains uses of assert
for checking invariants or for sanity checks that are separate from uses of RA_ASSERT
. Those can be disabled in the usual way with -DNDEBUG, but note that -DNDEBUG will also disable assert
used in RA_ASSERT
(e.g. if RA_DO_CHECK is 1
).
+
ra::
contains uses of assert
for checking invariants or for sanity checks that are separate from uses of RA_ASSERT
. Those can be disabled in the usual way with -DNDEBUG, but note that -DNDEBUG will also disable any assert
s that are a result of RA_DO_CHECK=1
.
You can redefine RA_ASSERT
to something that is more appropriate for your program. As an example, examples/throw.cc
shows how to throw a user-defined exception.
+
The performance cost of the runtime checks depends on the program. Without custom RA_ASSERT
, RA_DO_CHECK=1
usually has an acceptable cost, but RA_DO_CHECK=2
may be more expensive. The default is RA_DO_CHECK=1
.
The following is an example of how errors might be reported depending on RA_DO_CHECK
.
+
The following example shows how errors might be reported depending on RA_DO_CHECK
.
ra::Big<int, 2> a({10, 3}, 1); @@ -1662,17 +1662,15 @@ RA_DO_CHECK=2
*** ra::./ra/expr.hh:389,17 (check()) Mismatched shapes [10 3] [40 3]. ***} RA_DO_CHECK=1
-*** ./ra/expr.hh:389: constexpr ra::Match<checkp, std::tuple<_UTypes ...>, std::tuple<std::integral_constant<int, I>...> >::Match(P ...) +./ra/expr.hh:389: constexpr ra::Match<checkp, std::tuple<_UTypes ...>, std::tuple<std::integral_constant<int, I>...> >::Match(P ...) [with bool checkp = true; P = {ra::Cell<int, const ra::SmallArray<ra::Dim, std::tuple<std::integral_constant<int, 2> >, std::tuple<std::integral_constant<int, 1> >, std::tuple<ra::Dim, ra::Dim> >&, std::integral_constant<int, 0> >, ra::Cell<int, const ra::SmallArray<ra::Dim, std::tuple<std::integral_constant<int, 2> >, std::tuple<std::integral_constant<int, 1> >, std::tuple<ra::Dim, ra::Dim> >&, std::integral_constant<int, 0> >}; int ...I = {0, 1}]: Assertion `check()' failed. - RA_DO_CHECK=0
-
-crickets - The results with You can redefine @@ -2980,6 +2978,7 @@ 6.3 Etc | |||
end , Octave/Matlab: | Slicing | ||
error: | Extension | ||
every : | Reference | ||
exception: | Error handling | ||
explode : | Reference | ||
| |||
F |
---|