Subj : Re: Dartmouth BASIC to C To : comp.programming From : Rob Thorpe Date : Mon Aug 08 2005 09:03 am Gerry Quinn wrote: > In article , JSmith@mail.net says... > > Having nothing better to do on a Saturday morning, I was looking at > > Kemeny & Kurtz's 1964 manual for BASIC: > > > > http://www.bitsavers.org/pdf/dartmouth/BASIC_Oct64.pdf > > > > Below is a C port of the first example program given in the manual. Can > > it be improved while preserving, as much as possible, the structure of > > the original BASIC program? > > > if(D == 0.0) > > { > > printf("no unique solution\n"); > > exit(EXIT_FAILURE); > > } > > This isn't a good use of exit(). The program hasn't failed, the data > has. Since the data error was detected, the program can congratulate > itself on a successful run. > > (Technically the data is embedded in this program, but that is > presumably something you will be changing over time.) > > So you should just print the above message and return normally. I'd say it would be best to return different error codes for: 1 Program failure and 2 Failure of user provided data Plus text error messages. .