reading about the reasoning behind wrapping C++ macros in do { ... } while (false) and it makes total sense but eurghhhhh ewwwwwwww aughhhhhhhh noooooooo this language is so gross sometimes

— hitscanner apologist ⚡
— tired trans woman ⚧️☣
— not always grumpy, she just looks like that 💀
— level/environment designer 🔨
— Current work: Skin Deep (at Blendo Games) 🐈
📍 Adelaide, Australia
Private page (for friends): @garbagegrenade
reading about the reasoning behind wrapping C++ macros in do { ... } while (false) and it makes total sense but eurghhhhh ewwwwwwww aughhhhhhhh noooooooo this language is so gross sometimes
Errrgh, bad memories. Abusing macros when it would've been better just to create a function instead.
I am all to happy to let my C++ knowledge fade away now I don't have to touch it.
There's some bits in the id Tech 4 code that use macros for build/platform/debugging-specific stuff, like:
#define EFX_VERBOSE 0
#if EFX_VERBOSE
#define EFXprintf(...) do { common->Printf(VA_ARGS); } while (false)
#else
#define EFXprintf(...) do { } while (false)
#endif
And since that's something that's known at compile time, I guess it's a valid use case. But bleaaaargh.