2 ms·
I once worked at a place that had a platform specific "DEBUG" log macro. It worked something like: DEBUG(msg); Except, it was defined in such a way that you ac
by icedchai 7y ago
I once worked at a place that had a platform specific "DEBUG" log macro.
It worked something like: DEBUG(msg); Except, it was defined in such a way that you actually had to have two closing parens, like DEBUG(msg)); It looked syntactically invalid, but whatever the macro did required it.
The entire code base was littered with WTFs like that...
- WalterBright 7y agoI hated debug macros. There just was never a clean way to write them. I was determined that D would not suffer from that problem. `debug` is a keyword in D, and you can do things like: debug printf("I got here\n"); and the printf only gets compiled in when compiling with -debug. (Any statement can be used after the printf.) Even better, semantic checks for debug statements are relaxed - for example, purity is not checked for them. Meaning you can embed debug printf's in functions marked 'pure', instead of having to use a monad.