6 ms·
The only downside to print statements is forgetting to remove them and having some obnoxious message committed.
by dekz 15y ago
The only downside to print statements is forgetting to remove them and having some obnoxious message committed.
- jrockway 15y agoThis is rarely a problem when using tools like darcs, magit, or git-add --patch.
- angusgr 15y agoA useful trick we've had at previous workplaces which solves this (and related accidental-debug-code-checkin) problems is to put a precommit hook that denies a checkin with a certain string in the text (we used "DNCI" for Do Not Check In) So you get in the habit of annotating test tweaks & debug prints with: printf("DNCI x is %d\n", x); I use gdb as well, but sometimes dumping data directly is all you really need.