Sender: vheyndri AT rug DOT ac DOT be Message-Id: <34E2DDC9.4DCD@rug.ac.be> Date: Thu, 12 Feb 1998 12:32:25 +0100 From: Vik Heyndrickx Mime-Version: 1.0 To: Hans-Bernhard Broeker Cc: DJ Delorie , djgpp-workers AT delorie DOT com Subject: Re: char != unsigned char... sometimes, sigh (long) References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Precedence: bulk Hans-Bernhard Broeker wrote: > > On Tue, 10 Feb 1998, Vik Heyndrickx wrote: > > > - many users do not expect that '`' (the Greek letter alpha with EASCII > > value 224 in DOS CP 437 or 850) is not equal to 224. IMHO, this is > > strongly counterintuitive. This triggers unexpected (and never wanted) > > outputs in printf("%d", ...) and printf ("%u", ...) statements. > > I don't think we should pay that much attention to what users _expect_, > even more so if they expect the wrong things... E.g., I can't see any good > reason why anyone should 'printf("%d", '`'). If you want a char to > represent a *number*, then why (other than for the IOCCC) would you want > to assign a value in '' notation to it? Users who mix up the use of 'char' > for actual characters, and for 'small integers' might as well get what > they asked for. To support my idea of users expecting things: -------------------------------------------- The following is a short quote from http://i44www.info.uni-karlsruhe.de/~drepper/conf96/paper-5.html by Ulrich Drepper (a non-newbie!) --------------------------------------------------------------------------------------- The existence of a character other than the default ASCII character set is completely transparent to the program. Depending on the currently selected locale for the category LC_CYTPE the function can returned different values. Example: ASCII character set isalpha('|') == 0 && toupper('|') == '|' ISO-8859-1 character set isalpha('|') != 0 && toupper('|') == '\' --------------------------------------------------------------------------------------- Although this is only example code, even he takes it for granted that '|' is a positive value. To make my point: I think we SHOULD pay much attention to what users expect and solve the problem at the origin. -- \ Vik /-_-_-_-_-_-_/ \___/ Heyndrickx / \ /-_-_-_-_-_-_/