Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site h-sc1.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!harvard!h-sc1!thau From: thau@h-sc1.UUCP (robert thau) Newsgroups: net.bizarre Subject: Re: Bizarre Code Message-ID: <533@h-sc1.UUCP> Date: Thu, 15-Aug-85 00:00:58 EDT Article-I.D.: h-sc1.533 Posted: Thu Aug 15 00:00:58 1985 Date-Received: Mon, 19-Aug-85 05:38:57 EDT References: <462@moncol.UUCP> Organization: Harvard Univ. Science Center Lines: 35 > What is the most bizarre line/piece of code you have seen in a production > program? > > Name: John Ruschmeyer I'm working in a bio lab which is heavily computer-based (computers control the experiments and do all the analysis). The programs are written by local people, who are biologists, not programmers. This results in a few real gems. (Note: The lab uses Whitesmith's C, with its hopelessly braindamaged library. I've translated where appropriate): To null-terminate a string terminated by newline: register char *cp; ... cp = index(s, '\n'); /* Note lack of error-check */ strcpy(cp, "\0\0"); To set cp to be four characters from the end of string s: /* This is O(n^2) */ for (cp = s; strlen(cp) > 4; cp++) ; To output an escape sequence (never mind why ...): printf("%c%c", '\033', 'F'); etc. -- Robert Thau \ Keeper of the *FLAME* )) rst@tardis.ARPA ( ( h-sc1%thau@harvard.ARPA \\