logoalt Hacker News

toxikyesterday at 6:32 PM1 replyview on HN

Not just for functional programmers. Prints and other I/O operations absolutely are side effects. That's not running counter to the point being made. Print in an assert and NDEBUG takes away that behavior.


Replies

nealabqyesterday at 9:32 PM

You're right of course. I was thinking specifically of printing log/debug statements in the assert(..), but that usually only happens if the assert(..) fails and exits, and in that case the "no side effects" rule no longer matters.