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: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 6 Jul 2005 10:48:38 -0700 (PDT)

:
:On Tue, Jul 05, 2005 at 11:20:24PM -0700, Matthew Dillon wrote:
:>     Whoops, we have a problem with the ctype code... it is not properly
:>     folding negative integers (i.e. when a signed char is passed to 
:>     an is*() function).
:
:That's a bug in the test case, not in the ctype functions. You MUST pass
:unsigned char values to it, NOT signed char. Actually, that code might core
:dump. The only valid exception is EOF (-1).
:
:Joerg

    No, that isn't a bug in the test case.  It is perfectly valid to pass
    a char to an is*() function.  It does NOT have to be unsigned, and
    the is*() function is expected to return the correct result.

    We have to fix the is*() functions, plain and simple.

    EOF ?  Where'd EOF come from?  EOF is not a valid character.  It's the
    same as 'char c = 0xFF' and thus the is*() functions must return a
    representation for 0xFF in that case.

    The is*() functions MUST properly fold signed chars to return the correct
    result.  There is no two ways about it.  It MUST work, period.

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



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