Very disappointing not to see an #if 0 (my personal go-to for decades) in this meme. 😞
beat me to it too, it’s a meme of course but the advantage compared to comments is thay you get syntax highlighting 😁
Damn, you beat me to it.
It’s common enough that it’s supported like a comment by numerous syntax highlighting schemes, and has the added benefits of guaranteeing that the code won’t be compiled as well as encapsulating any pre-existing block comments. Conversely, if (false) is total garbage.
A simple if (false)
will get optimized out by any modern C or C++ compiler with optimizations on, but the problem is that the compiler will still parse and spend time on what’s inside the if-block and it has to be legal code, whereas with the trick the whole thing gets yeeted away by the preprocessor before even the compiler gets to look at it regardless of whether that block contains errors or not.