3 ms·
I've been programming for 30 years now, I remember back before syntax highlighting. I had a bug that I couldn't track down - it took forever. I had an infinit
by jpollock 11y ago
I've been programming for 30 years now, I remember back before syntax highlighting. I had a bug that I couldn't track down - it took forever. I had an infinite loop that would only run 3 times and then exit.
Here was the problem:
for (int i=0;i<3;++i) {
/* Initialize important things.
frozzleTheNozzle();
}
while (1) {
/* Do ALL THE THINGS. */
makeSureTheNozzleStaysFrozzled();
}
Syntax highlighting prevents the entire class of bugs from happening (as do compiler warnings, but hey). I told one of the other guys I was working with, and he introduced me to emacs which had just gained font-lock mode.
- mikeash 11y agoThe lack of syntax highlighting in your comment really illustrates the problem nicely. Took me longer than it should have to spot the problem!
- 0942v8653 11y agoHeh, I tried to scroll to the right to see the rest of the line. Swift's nested block comments would sort of fix the problem, but syntax highlighting would work with C. I will say though that highlighting comments and strings separately from the code doesn't necessitate full syntax highlighting. I remember (and have saved somewhere) an article on syntax highlighting where only comments were highlighted.
- nova 11y agoAlso automatic indentation.
- ams6110 11y agoYes, this alone will often spot problems such as unterminated comments or unbalanced brackets. When the next line doesn't indent to where it should be, you know there's a problem somewhere above.