I am currently working on a mixed C and C++ project. Lately it happened that external library I have no control over added an inline function containing register keyword to header. For simplicity let's assume header looks like this:
// external_header.h
inline int do_stuff() {
register int res = 1;
return res;
}
// some functions declarations without name mangling
And let's assume this is my code (as usless as it is):
// my_code.cpp
#ifdef __cplusplus
extern "C"{
#endif
#include <external_header.h>
#ifdef __cplusplus
}
#endif
int main(inc argc, char** argv) {
return 0;
}
Compiling my_code.cpp with C++17 switch gives error like this:
error: ISO C++17 does not allow ‘register’ storage class specifier [-Werror=register]
Can there be anything done to work around this error? If so, what is to be done?