News for hackers. Stuff that matters.
Re:Deciphering C++ compiler errors: Nonsensical errors from ... by jamesfinlayson on Thursday December 12, 2024 @01:06AM (#42396651)
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.

Re:Deciphering C++ compiler errors: Nonsensical errors from ... by cordenr on Thursday December 12, 2024 @03:17AM (#42397288)
In 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...

Re:Deciphering C++ compiler errors: Nonsensical errors from ... by jamesfinlayson on Thursday December 12, 2024 @04:26AM (#42397636)
Yeah 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.
Re:Deciphering C++ compiler errors: Nonsensical errors from ... by o11c on Thursday December 12, 2024 @07:39PM (#42404913)
That'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.

Re:Deciphering C++ compiler errors: Nonsensical errors from ... by jamesfinlayson on Thursday December 12, 2024 @11:57PM (#42406029)
Yeah okay - this was an MSVC project with inline assembly.