Avoid using std::raise() for divide by zero

Reference issue

!1076 (merged)

What does this implement/fix?

Since commit 7b2901e2 there is a dependency on std::raise(), but the header <csignal> might not exist or be usable on embedded targets or operating systems where UNIX signals are not implemented. Instead of calling std::raise(), we can force evaluation of an integer division by zero. This should not result in any functional changes on most systems, as that division will be translated to a SIGFPE and the process exits with exist code 136.

We use volatile variables here which forces the compiler to evaluate the expression even though it is unused: see https://godbolt.org/z/qYjdaq94s

Additional information

This is required to use Eigen on embedded operating systems.

Merge request reports

Loading