quote:Original post by Etnu
quote:
Or #ifdef. I mean, that''s why it''s there. Leave comments for, well, comments.
That was the original point of this thread - #ifdef is extremely ugly, and I was trying to get rid of it.
I don''t find it
extremely ugly. The preprocessor can be ugly (both code-wise and aesthetically) but this is one place I think it''s all right. And even if it were ugly in this case, #ifdef''s are probably the most common way to do code removal like this and are therefore one of the most readable. If it''s just for you and not intended for anyone else, I think your best bet is if(0);else/if(1);else. But you seem to have worries that that won''t be optimized out. There''s only one way to be absolutely certain it will be removed in all cases, and that''s an #ifdef. So, options:
1) Use #ifdef, be sure it''s removed, and follow a common idiom
2) Use one of the macros provided, be sure it''s removed on any real-world optimizing compiler, and have something that you find more visually pleasing
3) Change languages to one that has what you want built in. C and C++ aren''t the only, nor in general the best, language.