[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hi this is bill
This is all getting a bit off-topic...but I can't resist it...
Keith Lucas wrote:
> Thanks. Now I've got this horrid mental picture of 10000 line long routines with
> single letter variable names. All written with as much on one line as possible
> because that's faster...
Oh - you mean stuff like this:
...when I was actively collecting stuff for this page, someone
emailed me a 5 MEGABYTE source file that someone on his computing
course had written to sort (IIRC) 40 numbers into ascending order.
The code started off:
void sort ( int a, int b, int c, ...int aa, int bb, ...,
int *A, int *B, int *C, ....int *AA, int *BB, ...)
if ( a < b && b < c && c < d && ...
z < aa && aa < bb && ... )
*A = a ; *B = b ; *C = c ; ....
if ( a > b && b < c && c < d && ...
*B = a ; *A = b ; *C = c ; ....
...but the guy obviously realised after typing a few *hundred*
of these that this wasn't going to work and after evidently
attending the 'Programming-101' lesson on the 'else' clause,
started to do a kind of binary chop:
if ( a < b )
if ( b < c )
if ( c < d )
if ( d < e )
...then towards the end after about 4.999Mb of typing, he learned
about arrays and wrote:
array=a; array=b; ....
...and finished it off with some kind of a nasty bubble sort and...
*A=array; *B=array; ...
...leaving all of the earlier special-case code intact.
Well it was a wonder to behold and although gcc wouldn't
compile it, I'm told that it actually worked on the machine
that it was written on.
I don't believe it will be possible for there EVER to be worse
code than that.
Steve Baker (817)619-2657 (Vox/Vox-Mail)
Raytheon Systems Inc. (817)619-2466 (Fax)
Work: email@example.com http://www.hti.com
Home: firstname.lastname@example.org http://web2.airmail.net/sjbaker1