🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #29088

Re: MWC problems

#29088
From: ftw
Date: Thu, 05 Nov 1987 15:41
68 lines
2658 bytes
kevin@Lindy.UUCP writes:

> When compiling something with Mark Williams C, I got the following
> error message:

> 603: In cc1: Fatal error: Internal compiler error: FFFFA77E

> Here are lines 602 & 603:

> [602]	while ( *p != ' ' && *p != '\t' && *p != '\n' && *p != '\0')
> [603]		*p++;

> with the declaration:
> register char *p;

> Could someone tell me what's going on?  I don't see anything wrong with
> the above bit of code...

What exactly do you want to do in line 603?  It seems reasonable to assume
you want to increment the pointer, which is what should happen given your
code fragment.  If this is the case, the extra indirection is not necessary.
You can simply say:

	while (*p != ' ' ...)
		p++;

If you *really* want to increment the thing pointed at by "p", then you must
say either:

	while (*p != ' ' ...)
		(*p)++;  /* ugly */

or:

	while (*p != ' ' ...)
		++*p;

The reason being that "++" has higher precedence than indirection ("*"), so
in your example the _pointer_ is incremented, then dereferenced by "*".
The compiler is probably confused because it expects some form of assignment
to be taking place at about that point, as in "ch = *p++;" which increments
"p", and assigns the thing now pointed at by "p" to "ch".  Your line 603
is in error (semantically), but so is the compiler if it can't deal with
that expression.  The compiler should produce a diagnostic like "foo.c: 603:
useless expression".

The reason "++*p;" increments the thing pointed at by "p" is that "++"
evaluates from right to left, and the expression on the right ("*p") is
then evaluated.


> thanks..
> -- 
> Kevin Burnett
> Stanford Linear Accelerator Centre / Santa Clara Class of '88
> Arpa: kevin@Lindy.Stanford.EDU		Bitnet: KJBSF@SLACVM.BITNET
> Old-style UUCP: ...!decwrl!labrea!Lindy!kevin

Your welcome!


				Farrell T. Woods 

Datacube Inc. Systems / Software Group	4 Dearborn Rd. Peabody, Ma 01960
VOICE:	617-535-6644;	FAX: (617) 535-5643;  TWX: (710) 347-0125
INTERNET: ftw@datacube.COM
UUCP: {rutgers, ihnp4, mirror}!datacube!ftw
Technical Details
Message-ID: <105100026@datacube>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cca!mirror!datacube!ftw
References: <423@Lindy.STANFORD.EDU>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!cca!mirror!datacube!ftw
From: ftw@datacube.UUCP
Newsgroups: comp.sys.atari.st
Subject: Re: MWC problems
Message-ID: <105100026@datacube>
Date: Thu, 5-Nov-87 10:41:00 EST
Article-I.D.: datacube.105100026
Posted: Thu Nov  5 10:41:00 1987
Date-Received: Sun, 8-Nov-87 13:11:32 EST
References: <423@Lindy.STANFORD.EDU>
Lines: 68
Nf-ID: #R:Lindy.STANFORD.EDU:-42300:datacube:105100026:000:2048
Nf-From: datacube.UUCP!ftw    Nov  5 10:41:00 1987