www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/22/02:48:21

From: "R.G. Morgan" <R DOT G DOT Morgan AT ncl DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Laugh at my mistakes (Errors you wish you're mother told you about)
Date: 21 Oct 1996 09:46:01 GMT
Organization: University of Newcastle upon Tyne
Lines: 32
Distribution: world
Message-ID: <54fgop$eoe@whitbeck.ncl.ac.uk>
NNTP-Posting-Host: glen7.ncl.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


  I've been programming C for a little while now,  and have more or less completed
my first non-trivial program.  During this process I tore out (metaphorically)
much hair due to these mistakes:

   1)   int i;
        for (i = 0; i < SOME_NUMBER; i++);
          {
             ....
          }

  I wonder why that loop only executes once?

   2) 	FILE *fp;   /* far, far away */
	...
	fflush(NULL);

  intended to flush all streams, an uninitialised FILE pointer causes a SYSSEG
on execution.

   3)	#include <somefile.c>

  Of course I meant .h,  but with hundreds of "previously defined" errors spraying
out of gcc, this took some time to spot.

  In all these cases the compiler (rightly) generated no warning.  My question
is,  does anyone else know of any similar mistakes I might make so that I 
recognise them when the errors start to flow ?

----
5-0    R.Morgan R DOT G DOT Morgan AT ncl DOT ac DOT uk

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019