Hard to find errors

Roy Smith roy at alanine.phri.nyu.edu
Sat Jan 6 10:11:12 AEST 1990


	Somebody was looking for hard-to-find errors in C programs, to
compile a list of them.  Here's one I just committed (but fortunately
caught as soon as I typed it).  I meant to type

	while (pos < old->next->n)

but transposed the second -> and ended up with

	while (pos < old->next>-n)

which appears to be legal.  You can parse it as

	while (pos < (old->next) > -n)

which is legal, but certainly not what I meant.  I suppose this might draw
some warnings about illegally mixing integers and pointers, so it might not
be so hard to find.  I honestly don't know offhand which way the "<" and ">"
group, nor do I really care.
--
Roy Smith, Public Health Research Institute
455 First Avenue, New York, NY 10016
roy at alanine.phri.nyu.edu -OR- {att,philabs,cmcl2,rutgers,hombre}!phri!roy
"My karma ran over my dogma"



More information about the Comp.lang.c mailing list