[WIP] [FS#1030] Add, use, and test DUNE_ASSERT_BOUNDS
Turning flyspray/FS#1030 (closed) into a merge request to make it easier to view the relevant changes.
Merge request reports
Activity
- dune/common/boundschecking.hh 0 → 100644
1 #ifndef DUNE_BOUNDSCHECKING_HH 2 #define DUNE_BOUNDSCHECKING_HH 3 4 #include <dune/common/exceptions.hh> 5 6 #ifdef DUNE_CHECK_BOUNDS 7 #define DUNE_ASSERT_BOUNDS(cond) \ To allow an easy hook into the assert I suggest to guard the DUNE_ASSERT_BOUNDS with an
#ifndef DUNE_ASSERTS_BOUND
Edited by Christian Engwer
The reason that this is still marked as WIP for is: The patchset as it currently stands, does four things:
- It adds an assertion macro
- It adds bounds checking to a few functions that currently don't have it
- It uses the assertion macro instead of custom bounds checking in a few functions
- It tests all of the above.
What I'm unsure about is the third part: In a few places I'm changing exceptions of type (
FMatrixError
guarded byDUNE_FMatrix_WITH_CHECKING
) into exceptions of type (RangeError
guarded byDUNE_CHECK_BOUNDS
), e.g. whenFieldMatrix::mv
checks the dimensions of its arguments. I'm not sure if that's acceptable or even an improvement -- again, the question is if a one-size-fits-all single-argument macro suffices.Added 1 commit:
- 5b618064 - Do not guard DUNE_UNUSED_PARAMETER
mentioned in merge request !17 (merged)