PlatformIO IDE v 2.2.0, Core 3.6.7
VSCode v 1.35.1
Linux Mint v 17.2
gcc v 4:4.8.2-1ubuntu6
I want to display some info about a Class using typeid
, and I know that requires having build_unflags = -fno-rtti
in my platformio.ini, which I have. But I also want to not require that a user enable rtti, because of the additional memory it uses. So I want to do something like this:
#if <something that positively tells the compiler that rtti is enabled>
virtual const char* getClassName() { return typeid(*this).name(); }
#endif
and use the same #if / #endif
around the one line that actually displays the calls name in the Serial Monitor. But I’ve tried all kinds of things for that , and nothing seems to detect that rtti is enabled, because my method is never defined and my display code is never called.
Is there something that will tell the preprocessor that rtti is enabled, or not? Thanks!