On Fri, Dec 13, 2002 at 03:26:54PM +0300, Andrey A. Chernov wrote: > Since both operands are unsigned, result can't be negative, but supposed > to be. Here is the fix: > > --- b.c.bak Fri Dec 13 14:54:12 2002 > +++ b.c Fri Dec 13 15:20:15 2002 > @@ -292,7 +292,7 @@ > s[0][0] = a; > s[1][0] = b; > if ((r = strcoll(s[0], s[1])) == 0) > - r = (uschar)a - (uschar)b; > + r = (int)((uschar)a) - (int)((uschar)b); > return r; > } > Pardon my ignorance here, but the following fragment returns -1, doesn't it?
#include <stdio.h>
void
main(void)
{
int i;
i = (unsigned char)1 - (unsigned char)2;
printf("%d\n", i);
}
Cheers,
--
Ruslan Ermilov Sysadmin and DBA,
[EMAIL PROTECTED] Sunbay Software AG,
[EMAIL PROTECTED] FreeBSD committer,
+380.652.512.251 Simferopol, Ukraine
http://www.FreeBSD.org The Power To Serve
http://www.oracle.com Enabling The Information Age
msg48644/pgp00000.pgp
Description: PGP signature
