[net.lang.c] structure == structure

rcj@burl.UUCP (R. Curtis Jackson) (01/30/84)

Here's the program /* VERY simple */ :

------------------------------------------------------------
# include <stdio.h>
typedef struct
	{
		unsigned
			w1 : 1,
			w2 : 1,
			numreg : 1,
			as : 1,
			sd : 1,
			sp : 1,
			error : 1;
	} FLAGS ;
typedef struct
	{
		char	*sval;
		long	lval;
		short	tok;
		char	cval;
		FLAGS	flags;
	} YYSTYPE ;
main()
{
	YYSTYPE	a,b;

	a.flags.w1 = 1;
	b.flags.w1 = 1;
	if (a.flags == b.flags)
		printf("first test\n");
	a.flags.sd = 1;
	if (a.flags == b.flags)
		printf("second test\n");
}
------------------------------------------------------------

Here's the output from cc(1) -- (USG 5.0):

------------------------------------------------------------
"seqt.c", line 27: operands of == have incompatible types
"seqt.c", line 30: operands of == have incompatible types
------------------------------------------------------------

Here's the question:

Can one not compare structures at all, is this just some flaky
use of structure comparisons that is not allowed, or did I just
plain screw up /* or all of the above */?

Replies by mail or telephone ONLY, please, both to keep down net
traffic and because I don't read net.lang.c anymore.

Thanks very much for any time spent in helping this deranged person,
-- 

The MAD Programmer -- 919-228-3313 (Cornet 291)
alias: Curtis Jackson	...![ floyd clyde ihnp4 mhuxv ]!burl!rcj