From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: [9fans] same functions everywhere From: John Murdie To: 9fans@cse.psu.edu Cc: john@cs.york.ac.uk In-Reply-To: <622b8580ff4fa7e12cb655bf19694fe8@vitanuova.com> References: <622b8580ff4fa7e12cb655bf19694fe8@vitanuova.com> Content-Type: text/plain Message-Id: <1052497182.736.14.camel@pc118> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Date: Fri, 9 May 2003 17:19:42 +0100 Topicbox-Message-UUID: a5ed35a4-eacb-11e9-9e20-41e7f4b1d025 On Fri, 2003-05-09 at 14:21, rog@vitanuova.com wrote: > DAGwyn@null.net: > > when sizeof(char)== > > sizeof(int) it is very likely that all-one bits is a valid > > data value *as well as* the EOF marker > > don't most >8bit character encodings (including unicode) provide at > least one code point to represent "not a character"? > > anyway, i'm not arguing about the design of getc. maybe it should > have been > > int getc(FILE *f, char *c); > > filling in the character at c iff it returns 1. some of the plan 9 > rune(2) functions work in this kind of way. > > however, i would argue that using exceptions for such a thing would be > fairly unwieldy, and end up obfuscating what should be plain, > straightforward code. > > exceptions are surprising things: they do not facilitate linear > reading of the code; they should be kept for genuinely surprising > conditions. And then what should one do? Suppose that a "genuinely surprising condition" occurs when a launch vehicle is a few tens of seconds off the ground; just what should the program do? I agree with those here that hold the opinion that exceptions are no substitute for a well-thought-out and well-notated program (we used to call it "structured programming"). Need error handling obscure the "all's well" logic of the program? John A. Murdie Department of Computer Science University of York UK