4 ms·
"This trick below can be used to toggle between two sets of code, with one symbol in the code with no additional short-keys to learn, and no tool dependencies!"
by voyou 13y ago
"This trick below can be used to toggle between two sets of code, with one symbol in the code with no additional short-keys to learn, and no tool dependencies!"
So can #ifdef TEST / #ifndef TEST , which also has the advantage of not being horrific.
- Kurtz79 13y agoAgreed. That "trick" is a disaster waiting to happen, in a code base larger than a few hundreds lines of code.
- pygy_ 13y agoCue in Java, Javascript and PHP, which don't have preprocessor directives.
- deleted 13y ago[deleted]
- brokenparser 13y agoYes, yes, no. PHP is a preprocessor.
- aidenn0 13y agoUnless you run them through a preprocessor (which I recommend)
- mbenjaminsmith 13y agoI'm glad to know I'm not the only one abusing compiler macros for "ghetto source control". Having said that, there are plenty of cases where you can't use macros (like all languages/compilers/interpreters that don't support them). I don't agree with the author here though. Just comment the damn code out normally until you can clean everything up. Doing it that way encourages leaving that mess intact and forgetting about it.
- Lagged2Death 13y agoI don't think that counts as either "ghetto source control" or "abuse" and I'd be interested to find out why you feel this way. I mean, if you're talking about basic C, this (_DEBUG) is actually built-in to most systems from the get-go, for exactly this purpose. "Abuse?"