I have to deal with very old C++ code which is including a header file containing code snippets like this one,
static inline unsigned int
EventId(unsigned long Header) throw (std::string)
{
if (!isTDCHeader(Header) && !isTDCTrailer(Header)) {
throw std::string("CAENV1x90Data::EventId - not a tdc header");
}
else {
return ((Header & EVENTID_MASK) >> EVENTID_RSHIFT);
}
}
Snippets like this cause compiling errors like the following,
error: ISO C++1z does not allow dynamic exception specifications
Lost(unsigned long datum) throw (std::string)
I understand why this is happening, but I have no idea how to port this code to compile under C++17 with a minimal amount of "headache".
I found questions such as
but I am not able to translate the solution to my case as I am absolutely not a C++ "aficionado" (even though I promised myself to start someday...).