DragonFly BSD
DragonFly commits List (threaded) for 2005-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: ctype bug

From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Thu, 7 Jul 2005 02:26:22 +0200

On 07.07.2005, at 02:09, Matthew Dillon wrote:
:Matt, the ctype macros ALWAYS worked like this, at the very least back to
:the days of 4.4BSD. THIS IS NOT NEW. Just because some programmers don't like
:reading the documentation and follow what is clearly written there, doesn't mean
:that arbitrary changes are correct.
No, they never worked like this. Go back and look at rev 1.1 of
ctype.h in the FreeBSD source repository. Guess what it does? It
does a range check.

hm. looking at glibc and solaris, they don't do checks. looking at openbsd, they do it this way:

__inline int isprint(int c)
	return (c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)c) & ....)));

what I don't understand is why they even have the -1 in their table then...

now I'm split. first I was for bounds checking, but looking at other major systems I have to admit that I tend to not check it either. Best with a segfault for negative indices < -1 :) whatever. bedtime now.


Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low $$$ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \

Attachment: PGP.sig
Description: This is a digitally signed message part

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]