if (); (was:= vs ==)
William C. DenBesten
denbeste at bgsuvax.UUCP
Fri Jan 29 02:23:35 AEST 1988
> if (a);
> stat1;
> for (i = 1; i < 100; i++);
> fn3 (argument, i);
> Indentation is IGNORED by Lint and the compiler, but is superficially VERY
> significant to we visually oriented beings. Thus the occasional problem
> in spotting the above class of errors.
This statement hits a nail squarely on its head. I used to have
terrible problems with C syntax as I was learning C. I then
discovered c-mode in GNU emacs. Its basic trick is that it indents
the current line properly, depending on the lines before it. I
commonly make the above errors, forget to close a quote or
parenthesis, and a myrid of other errors. When I hit tab and the line
isn't adjusted to where I expect it to be, I know to take a look at
the previous couple of lines, and voila a typo is uncovered.
Another way to find this sort of error is to run your code through a c
beautifier (cb) and look at the way that it indents the code. Of
course, you have to be suspecting this sort of error to even think
about attemptin this.
---
William C. DenBesten | CSNET denbeste at research1.bgsu.edu
Dept of Computer Science | UUCP ...!cbosgd!osu-cis!bgsuvax!denbeste
Bowling Green State University |
Bowling Green, OH 43403-0214 |
More information about the Comp.lang.c
mailing list