C++ compilers really hate struct {...; char vla[];};. It gives warning for many struct declarations, which can be fortunately suppressed with:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#include <usb.h>
#pragma GCC diagnostic pop
But USB_ARRAY_DESC and USB_STRING_DESC_CXX fails with no rescue.
One workaround is to use this in another C file, and use extern "C" in c++. LTO gives warning about type mismatch between units.
I personally use this https://godbolt.org/z/aTG1aEP96 in my project. This looks somewhat overkill and it requires C++17/20.
What's your opinion on compatibility with C++?
C++ compilers really hate
struct {...; char vla[];};. It gives warning for many struct declarations, which can be fortunately suppressed with:But
USB_ARRAY_DESCandUSB_STRING_DESC_CXXfails with no rescue.One workaround is to use this in another C file, and use
extern "C"in c++. LTO gives warning about type mismatch between units.I personally use this https://godbolt.org/z/aTG1aEP96 in my project. This looks somewhat overkill and it requires C++17/20.
What's your opinion on compatibility with C++?