Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site eagle.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!eagle!mjs
From: mjs@eagle.UUCP (M.J.Shannon)
Newsgroups: net.lang.c,net.bugs.4bsd
Subject: Re: pcc compiler error
Message-ID: <1240@eagle.UUCP>
Date: Sun, 10-Feb-85 11:04:56 EST
Article-I.D.: eagle.1240
Posted: Sun Feb 10 11:04:56 1985
Date-Received: Mon, 11-Feb-85 05:48:26 EST
References: <814@enea.UUCP>
Organization: AT&T Bell Laboratories, Summit, NJ
Lines: 27
Xref: watmath net.lang.c:4318 net.bugs.4bsd:1374

> The following code tests the contents of a pointer to a struct ...
> 
> struct xy  {
> 	int x;
> 	int y;
> } a;
> 
> main()
> {
> 	struct xy *p;
> 
> 	p = &a;
> 	if (*p) {
> 		/* compiler error: zzzcode- bad type */
> 	}
> }

This is not legitimate code (and the compiler should point this out).
The value of `*p' here is identical to the value of `a', a `struct xy'.
Thus, another equivalent way of saying what you did (equally wrong, at
least) is: `if (a != 0) { /* stuff */ }'.  It just isn't valid to
compare a structure value against an integer value.  Perhaps what you
meant to say is: `if (p != (struct xy *) 0) { /* stuff */ }'.
-- 
	Marty Shannon
UUCP:	ihnp4!eagle!mjs
Phone:	+1 201 522 6063