Re:Why Const Doesn't Make C Code Faster
by Y_Y on Tuesday August 20, 2019 @02:20AM
(#20744268)
The same "trick" is especially handy in a pure-by-design language like Haskell. There you have the `trace` function which prints to stdout while pretending not to. It's similarly useful, even if it may get called zero or many times. Is the same true of D's debug?
[ Parent
| on HN ]
Re:Why Const Doesn't Make C Code Faster
by WalterBright on Tuesday August 20, 2019 @02:39AM
(#20744346)
No, in D any statement prefixed with `debug` does not get its purity checked. `debug` prefixed code is enabled via a command line switch, otherwise it is excised.
I.e. it's for conditionally inserting debugging code where you don't care about purity, you just want to find the bug.