[comp.sys.mac.programmer] MPW C bug, again!

larryh@tekgvs.TEK.COM (Larry Hutchinson) (04/08/88)

Just when you thought it was safe to add!  An old bug that was
supposedly fixed in MPW C ver 2.0.2 turns out to have only been
wounded.

The following is the shortest program that I have found that exibits
the problem:


main(argc,argv)
	int argc;
	char *argv[];
{
	double	skuz[10];
	double	foo=4;

	skuz[5]= 2.3;
	skuz[5] += 4*foo;		/* this add fails */

	printf("skuz= %g\r",skuz[5]);
}

The value printed is 2.3, which is the symptom of the old bug.  It is just
a little harder to make it appear now.

I am getting a little tired of this bug.  Does anyone know when MPW 3.0
is due out?  I am really looking forward to a whole new round of bugs.


Larry Hutchinson, Tektronix, Inc. PO Box 500, MS 50-383, Beaverton, OR 97077
UUCP:   [uunet|ucbvax|decvax|ihnp4|hplabs]!tektronix!tekgvs!larryh
ARPA:   larryh%tekgvs.TEK.COM@RELAY.CS.NET
CSNet:  larryh@tekgvs.TEK.COM

PS
No, I haven't reported the bug to Apple.
(excuse: I don't have a modem and would procrastinate anyway.)

wetter@tybalt.caltech.edu (Pierce T. Wetter) (04/10/88)

>
>Just when you thought it was safe to add!  An old bug that was
>supposedly fixed in MPW C ver 2.0.2 turns out to have only been
>wounded.
>
   
   You think that's a bug? That's not a bug, this is a bug...

   short i,j,k,ok,l;

  Seems you can't have a varible named 'ok'.
  Ran into this one porting gnuchess. Arrgh.
Pierce Wetter

Famous last words:

--------------------------------------------

wetter@tybalt.caltech.edu

--------------------------------------------

spector@vx2.GBA.NYU.EDU (David HM Spector) (04/10/88)

This is only true if you include dialog.h.  ok is a constant (as in the default
button).   I agree its a pain, Apple should have #defined all of those constants
in mixed or uppercase.  But then again Apple should also have defined ints
to be 16 bits (uh-oh, I hear Larry Rosenstein saying.."arrgh! not again!" :-)
[yes, I have been working all weekend with MPW C... (*Sigh*)]


			David


-------------------------------------------------------------------------------
David HM Spector				New York University
Senior Systems Programmer			Graduate School of Business
Arpa: SPECTOR@GBA.NYU.EDU			Academic Computing Center
UUCP:...!{allegra,rocky,harvard}!cmcl2!spector	90 Trinity Place, Rm C-4
MCIMail: DSpector				New York, New York 10006
AppleLink: D1161     CompuServe: 71260,1410     (212) 285-6080
"SJM 25, 'real nice guy' seeks SJF...  What? This ISN'T The Voice personals?!"

drc@dbase.UUCP (Dennis Cohen) (04/11/88)

In article <6055@cit-vax.Caltech.Edu>, wetter@tybalt.caltech.edu (Pierce T. Wetter) writes:
>    You think that's a bug? That's not a bug, this is a bug...
> 
>    short i,j,k,ok,l;
> 
>   Seems you can't have a varible named 'ok'.
>   Ran into this one porting gnuchess. Arrgh.

Yes, you can have a variable named 'ok'.  The problem you are running into here
is that there are a couple of constants predeclared by the Dialog Manager as
per Inside Mac for ok and cancel (named, interestingly enough, ok and cancel).
You're trying to redeclare something here and the compiler, quite correctly,
is telling you that you can't.  If you don't bring in those libraries and
interfaces, ok will be a valid identifier.

Dennis Cohen
Ashton-Tate Macintosh Division
dBASE Mac Development Team
--------------------------
Disclaimer:  Any opinions expressed above are those of the author.