Subj : Re: Dartmouth BASIC to C To : comp.programming From : Jon Harrop Date : Sun Aug 07 2005 03:08 pm 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. Don't compilers return FAIL when the program they are run on is incorrect? -- Dr Jon D Harrop, Flying Frog Consultancy http://www.ffconsultancy.com .