On Sat, 14 Dec 2002, Ruslan Ermilov wrote:
> On Sat, Dec 14, 2002 at 09:02:40PM +1100, Bruce Evans wrote:
> > For ANSI C, the result of the subtraction only depends on the width
> > of unsigned char. If unsigned char has the same width as int, then
> > the result is UINT_MAX; otherwise the result
On Sat, Dec 14, 2002 at 09:02:40PM +1100, Bruce Evans wrote:
> On Fri, 13 Dec 2002, Ruslan Ermilov wrote:
>
> > On Fri, Dec 13, 2002 at 04:41:06PM +0300, Andrey A. Chernov wrote:
> > > On Fri, Dec 13, 2002 at 14:32:40 +0200, Ruslan Ermilov wrote:
> > > > Pardon my ignorance here, but the following
On Fri, 13 Dec 2002, Ruslan Ermilov wrote:
> On Fri, Dec 13, 2002 at 04:41:06PM +0300, Andrey A. Chernov wrote:
> > On Fri, Dec 13, 2002 at 14:32:40 +0200, Ruslan Ermilov wrote:
> > > Pardon my ignorance here, but the following fragment
> > > returns -1, doesn't it?
> > >
> > > #include
> > > voi
On Fri, Dec 13, 2002 at 17:09:42 +0200, Ruslan Ermilov wrote:
> :
> : * Integer types `unsigned short' and `unsigned char' promote to
> : `unsigned int'.
>
> With -traditional, the code I quoted still produces -1.
Probably because of machine-specific overflow handling or printf
On Fri, Dec 13, 2002 at 04:41:06PM +0300, Andrey A. Chernov wrote:
> On Fri, Dec 13, 2002 at 14:32:40 +0200, Ruslan Ermilov wrote:
> > Pardon my ignorance here, but the following fragment
> > returns -1, doesn't it?
> >
> > #include
> > void
> > main(void)
> > {
> > int i;
> >
> >
On Fri, Dec 13, 2002 at 14:32:40 +0200, Ruslan Ermilov wrote:
> Pardon my ignorance here, but the following fragment
> returns -1, doesn't it?
>
> #include
> void
> main(void)
> {
> int i;
>
> i = (unsigned char)1 - (unsigned char)2;
> printf("%d\n", i);
> }
It very depe
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;
>
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 = (