common bugs in C programs
Ted Schroeder
ted at ultra.com
Fri Dec 29 07:04:33 AEST 1989
Bob.Stout at p6.f506.n106.z1.fidonet.org (Bob Stout) writes:
>In an article of <22 Dec 89 03:33:00 GMT>, damerla at uicbert.eecs.uic.edu writes:
> >I am compiling a list of syntax and logical errors I ever made while writing
> >C programs. Some of these errors are very simple but hard to debug like
> >typing = in place of ==. Till now I have compiled about 25 of them and any
> >contributions to this list will be appreciated.
>If you make it a matter of style to write conditionals as (const == var)
>rather than (var == const), your compiler will flag the error for you and make
>your code *much* easier to debug.
Ah, but how ugly the code becomes. There are few things that are more
annoying to me than to have a piece of code assert if (2 == x) return; 2 does not
equal something, but something may in fact be equal to 2.
Ted Schroeder ted at Ultra.com
Ultra Network Technologies ...!ames!ultra!ted
101 Daggett Drive
San Jose, CA 95134
408-922-0100
Disclaimer: I don't even believe what I say, why should my company?
More information about the Comp.lang.c
mailing list