ctype bug

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Wed Jul 6 17:09:37 PDT 2005


Lately Joerg Sonnenberger <joerg at xxxxxxxxxxxxxxxxx> said:

> On Wed, Jul 06, 2005 at 04:45:08PM -0700, Matthew Dillon wrote:
> > 
> > :*sigh* Which behaviour should be used instead? It can't return an error,
> > :because this functions are not supposed to return errors. Second, it can't
> > :return an arbitrary value, because that can be considered wrong too.
> > :Third, it can't magically cast them to unsigned, because 255 is a valid letter
> > :in UTF8, but also (signed)255 == EOF.
> >     Joerg, just because the standard says undefined doesn't give us license
> >     to allow an API function to randomly overflow an array and return garbage.
> >     It just doesn't, and we aren't going to do it.  It's totally
> >     inappropriate, in fact.  libc has to be more robust then that. 
> It returns as much garbage as FreeBSD returned. Returning '0' for an invalid
> argument is as invalid as any other value.

it's not invalid. it's "undefined". but in a way we think it makes sense.
strictly conforming programs won't have problems with that.

cheers
  simon

-- 
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:
pgp00012.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00012.pgp
Type: application/octet-stream
Size: 189 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/commits/attachments/20050706/78052b44/attachment-0022.obj>


More information about the Commits mailing list