4 ms·
Ugh... I had something similar recently but much more painful to figure out - apparently googletest defines and and or (lowercase) as macros). I started using
by jamesfinlayson 2y ago
Ugh... I had something similar recently but much more painful to figure out - apparently googletest defines and and or (lowercase) as macros).
I started using googletest in a project with a moderate amount of inline assembly, and of course I got some thoroughly confusing error messages after the substitution replaced the and and or opcodes.
Anyway, I didn't know that push_macro and pop_macro existed, so I'll have to revisit my previous hack around that issue.
- cordenr 2y agoIn C++ they're alternative tokens and should be keywords, so maybe googletest is providing them as macros as workaround for a compile that didn't support this? In other words, maybe a computer flag would allow you to disable them being defined? Although this could result in other issues...
- jamesfinlayson 2y agoYeah I kind of thought it was something like that, but searching for such broad terms got me nowhere, and the googletest documentation wasn't good enough for me to find it.
- o11c 2y agoThat's standard if `<iso646.h>` is included in C, but said header is a nop for C++. In the GCC world, inline asm uses strings so macros don't cause problems.
- jamesfinlayson 2y agoYeah okay - this was an MSVC project with inline assembly.