Yes, it is true that an optimising compiler is likely to just remove those if statements so there would be zero overhead.Originally Posted by Bladactania
EDIT:
I just remembered: the standard assert macro depends on whether NDEBUG is defined, and it would be good to use this... but it does not fit so well into your example as it does with Snafuist's example, since you are relying on boolean values whereas Snafuist relies on whether a name is defined, just like how assert works.