[comp.sys.amiga.tech] char causes guru

dlarson@blake.acs.washington.edu (Dale Larson) (10/27/89)

The following 10-line code fragment gives me Guru #3 when c is a char, but
works just fine with c as an int.  I've had the same result with 32-bit ints
and 16-bit ints under Manx3.6a and under Manx4.9a BETA.

Can anyone explain this GURU?   I would be eternally greatful!!!

(Almost forgot -- according to SDB and the messages printed around it,
 the guru is on the while statement, and I can isolate it to just the
 Message = GetMsg part)


BOOL BSGet(char *buffer, int len)
{
	register struct IntuiMessage *Message;
	register int index = 0;
	char c;  /*  If this is changed to int, it works!!!  */

	while (index < len-1)
	{
		puts("about to GetMsg(W->UserPort)");
		while( (Message = (struct IntuiMessage *)
			GetMsg(W->UserPort))==NULL)
			WaitPort(W->UserPort);
		puts("did GetMsg ok...");
...
-- 
	    A lack of prior planning on the part of any programmer 
		       always constitutes an emergency.
	
           Digital Teddy Bear      dlarson@blake.acs.washington.edu

dlarson@blake.acs.washington.edu (Dale Larson) (10/27/89)

Addendum:  It also works if I make c a global variable (much better, in fact,
than if I make c an int :-)

-- 
	    A lack of prior planning on the part of any programmer 
		       always constitutes an emergency.
	
           Digital Teddy Bear      dlarson@blake.acs.washington.edu