Collecting favorite bug stories
"Lord of Sith" Kajihara
skajihar at udenva.UUCP
Tue Jan 13 03:26:13 AEST 1987
In article <3669 at curly.ucla-cs.UCLA.EDU> you write:
>I am collecting anecdotes of experiences, (real or imagined)
>for a book to be titled:
>
> MY FAVORITE BUGS: Humourous, and Horrible Experiences in Software
> Engineering.
>
>As one might tell from the title, the book will be filled with wonderful
>tales that programmers tell each other, over a few too many beers,
>after a long day at the keyboard.
>
Sorry about posting this, but we do not support ARPA here.
I don't know that this qualifies for what you ask, but the following comes
from an inexperience with C and file processing.
I had a program that would read from n text files and write to an output file.
The first time that I ran the program, I exceeded the amount of disc quota I
had on the system.
The problem: in using command-line arguments to identify my files, I had
inadverdently included my output file as input. Result: an endless loop.
In the following code, argc is the number of arguments to the program, argv
is an array of character pointers. argv[argc-1] is the output file.
.
.
.
for (inc = 1; inc <= argc-1; ++inc)
process(argv[inc],argv[argc-1]);
.
.
.
The solution is to make the condition of the for loop '<' rather than '<='.
I am only an undergraduate physics major so forgive me for my modest and
possibly trivial solution.
Scott Kajihara
--
________________________________________________________________________________
Me? A CS major? Now, I know that either you are joking or LAKking.
-- Scott Kajihara
UUCP: ...!udenva!skajihar
Disclaimer: the above quote is not meant to insult computer science types;
it is just that I could never become CS and remain my usual
insane self (they have always said that we are strange but
have charm).
________________________________________________________________________________
More information about the Comp.lang.c
mailing list