From: Thomas Demmer Newsgroups: comp.os.msdos.djgpp Subject: Lint for DJGPP Date: Wed, 18 Sep 1996 14:51:07 +0100 Organization: Lehrstuhl fuer Stroemungsmechanik Lines: 83 Message-ID: <323FFE4B.1CFB@LSTM.Ruhr-UNI-Bochum.De> NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Someone asked a few days ago about a lint for djgpp C A free version is available from ftp://larch.lcs.mit.edu/pub/Larch/lclint The source is available, so it should compile and run under DOS. Well, Eli said gcc -Wall -pedantic usually suffices, here is a little riddle. The following program contains 11 bugs/flaws. gcc finds 7. How many do YOU find? ;-) >>>>> snip >>>>>>>>>> /* main prog bsp.c: * print square numbers from "lower" to "upper". * Range given from commandline */ #include #include extern int lower, upper; extern void print_table(int, int); static const char *PROG; /* program name */ static void SHOW_USAGE() /* how to use */ { (void) printf((stderr,"Usage: %s [ [lower ] upper ]\n"), PROG); exit(); } int main(int argc, char *argv[]) /* MAIN PROGRAM */ { /* Set program name for usage * / PROG = argv[0]; /* in SHOW_USAGE */ if(argc > 3) SHOW_USAGE; else { /* get upper limit if given */ if(argc >= 2) upper = atoi(argv[argc-1]); /* get lower if given */ if (argc == 3); lower=atof(argv[1]); /* print table and exit */ print_table(lower, upper); return 0; } } /* * PRINTING FUNCTION */ #include int lower = 1; int upper = 100; int print_table(int lo, int hi) { int i; while(lower < upper) (void) printf("%7d ",++lower*lower); if ( i % 10 == 0) (void) printf("\n"); return i; } <<<< snap <<<<<<<<<< BTW, I found 8. -- Ciao Tom ************************************************************* * Thomas Demmer * * Lehrstuhl fuer Stroemungsmechanik * * Ruhr-Uni-Bochum * * Universitaetsstr. 150 * * D-44780 Bochum * * Tel: +49 234 700 6434 * * Fax: +49 234 709 4162 * * Voice/Fax Box: +49 2561 91371 2056 * * http://www.lstm.ruhr-uni-bochum.de/~demmer * *************************************************************