Autah-cs.156 net.bugs.v7 utzoo!decvax!duke!chico!harpo!utah-cs!lepreau Wed Jan 6 12:17:38 1982 Re: sizeof type botch (utzoo.1248) We decided that this is a compiler bug and fixed it. What prompted this rash action is that the "bug" has disastrous consequences for a canonical Unix code sequence: /* Read a "record" (struct), then back up to the beginning of it */ /* in order to update it in place. */ read(fd, (char *) &record, sizeof record); lseek(fd, (long) -(sizeof record), 1); Because the sizeof expr was unsigned, you seek to a very large positive number! (Of course one can write: -((long) sizeof record) but it's easy to forget...) The obvious negative aspect of this change is that sizeof (objects > 32K) doesn't work, but we think that's the lesser evil. One can always do (sizeof(array[0]) * ARRAYLEN). ------------- The fix follows, to c01.c. 43c43 type = UNSIGN; --- > t1->type = INT; /* was UNSIGN; J.Lepreau 5/81 */ ------------- ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.