[odb-users] Compile libodb for c++17
Antoine Gennart
antoine.gennart at quimesis.be
Thu Feb 23 02:48:29 EST 2023
Hello,
I am currently facing a problem while compiling the library libodb using
c++17. Libobd is currently using a removed feature of c++ which is the
dynamic exception specification. Below, I copied a small example code to
explain the problem of the current implementation.
Therefore I was wondering if there a plan to upgrade your library to
newer standard ? As far as I understand this error, this would be as
difficult as to remove the "throw"statement next to the function
definition, and it would also be nice to add a "noexcept" qualifier for
the functions that cannot throw errors.
Thank you for your time,
Best regards,
Antoine Gennart
g++ -std=c++17 main.cpp -o main
```
#include <iostream>
// does compile
void test_throw_1()
{
throw(1);
}
// does compile
// will call std::terminate when exception is throwed
void test_throw_2() noexcept
{
-- throw(1);
}
// does not compile
// deprecated since c++11
// removed since c++17
--void test_throw_3() throw(int)
{
throw(1);
}
int main (int argc, char *argv[])
{
std::cout << "Hello world" << std::endl;
try
{
test_throw_1();
test_throw_2();
test_throw_3();
}
catch (int& i)
{
std::cout << i << std::endl;
}
return 0;
}
```
More information about the odb-users
mailing list