[comp.sys.atari.st] Bugs in MWC? Also, Re: Disk I/O

Gribnif@UMass.BITNET (Dan Wilga at UMASS Amherst) (11/13/87)

        I have recently discovered a few peculiarities (read: what I think are
bugs) in MWC version 2.0.1:

       1) Declaration of integers: you would think that
               int i = -32768
          would work, since this is a valid number in ones-complement
          arithmetic, however this invariably results in the compiler message
          'integer "i" promoted to long'. Also, changing the "int" to "unsigned
          int" yields the same result whenever you are trying to assign
          any number >=32768 (without sign, of course).

       2) Try this:

          main()
          {
            unsigned long int ii;
            int a, b;

            ii = 0L;
            a = 4097;
            b = 8;
            ii += a * b;
            printf( "%D\n", ii );
          }

          The result I am lead to expect from all my reading is that the number
          4097*8=32776 would be stored in "ii", however the compiler fails to
          convert the result of "a*b" to unsigned long before adding it to
          "ii", so what gets stored is -32760, the ones complement of "a*b".
          The only way you can get this to work correctly is by specifying the
          type:
                 ii += (unsigned)(long)(a * b);
          Notice also that I did not use "(unsigned long)", as this does not
          work either.

        Ok, is it just me, or are these truly bugs? I'd kinda like to know
before I send that small incendiary device off to Chicago...
        Also, on the subject of the "f" I/O functions vs. the "F" ones, I
recently used fread to load a large (c300K) file directly into memory from my
hard disk. What I found was that not only did fread take about 4 times as long
to read the file, but it also started overwriting previously loaded data.
I tried loading it in different size blocks (starting at 16K, all the way down
to 128 bytes, which is smaller than the buffer size) with the same results.
Actually, in this case it made much more sense to Fread anyway, since it takes
a long as an argument, as opposed to an unsigned int for fread.
        Sorry about the length of this, folx, I'm just making up for all those
times I wanted to put in my two bits and never got around to it...

                                     Dan Wilga

------------------------------------------------------------------------------
   AndOr@UMASS.Bitnet     "In those days, men were real men, women were real
   (Arpa? Don't ask!)      women, and small furry creatures from Alpha Centauri
                           were real small furry creatures from Alpha Centauri"
                                  -- Hitchhikers