<<< Date Index >>>     <<< Thread Index >>>

Re: [PATCH] warning cleared



To show that this is not theoretical... Under Linux, the bug doesn't
show up. However, it is a problem under OSF1. Consider the following
program:

#include <stdio.h>
#include <ctype.h>
#include <limits.h>

#ifndef CAST
#define CAST
#endif

int main (void)
{
  char c = CHAR_MIN;

  printf ("Digits:");
  while (1)
    {
      if (isdigit ((int) CAST c))
        printf (" %d", (int) c);
      if (c == CHAR_MAX)
        break;
      c++;
    }
  printf ("\n");
  return 0;
}

Under OSF1, I get:

Digits: -116 -115 -114 -113 -112 -111 -110 -109 -108 -107 -106 -105 -104 -103 
-102 -101 -84 -83 -82 -81 -80 -79 -78 -77 -76 -75 -74 -73 -72 -71 -70 -69 -52 
-51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -20 -19 -18 -17 -16 
-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 48 49 50 51 52 53 54 55 56 57

When compiled with -DCAST="(unsigned char)", I get as expected:

Digits: 48 49 50 51 52 53 54 55 56 57

So, Mutt may behave strangely under OSF1.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA