ccc_ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (03/07/90)
Here's some example code, adapted from NCSA Telnet, that I've tried compiling
with both version 3.0 and 3.1 of MPW C. This code actually illustrates two
separate bugs, one in each statement.
In the first statement, the compiler succeeds in making almost complete
nonsense of the conditional expression. In the second statement, it puts
the result of the comparison into the condition codes, and then inadvertently
destroys them before it gets around to storing the value in the destination.
------------------------------------------------------------------------------
#include <QuickDraw.h>
#define MB_READ 0
#define MB_WRITE 1
#define MB_DISABLE 0x80
#define FAMODE 0
int
MacBinary,
ftptmode,
mbfp,
defaultv;
struct
{
int monospaced;
}
*RSlocal;
int
i;
main()
{
mbfp = MBopen
(
"test",
defaultv,
MB_WRITE
+
(
(!MacBinary) || (ftptmode == FAMODE) ? MB_DISABLE : 0
)
);
RSlocal[i].monospaced = CharWidth('I') == CharWidth('W');
}
------------------------------------------------------------------------------
Lawrence D'Oliveiro, Computer Services Dept, University of Waikato,
Hamilton, New Zealand
ldo@waikato.ac.nz