[net.unix-wizards] structures, enum

tim (10/08/82)

"Recent Changes in C" is ambiguous on a few important
points about structure assignment and the enum type.
(1) When structures are passed to a function, is the
    call by reference or by value?
(2) What operations are legal on enum variables?
(3) What automatic conversions apply to enum variables?
    What explicit conversions?
				Tim Maroney ( unc!tim )

thomas (10/08/82)

struct foo { ... } fooinst;

f(fooptr)
struct foo * fooptr;
{}

g(fooinst)
struct foo fooinst;
{}

struct foo h() {}

...
	f(&fooinst);			/* pass address of fooinst */
	g(fooinst);			/* Pass contents of fooinst */

	fooinst = h();			/* Return new contents of fooinst */
...

================================================================
Enums are treated differently by different compilers.  If you're using
(Berkeley) pcc, you can't do any arithmetic on enums.  If you're using
the V7 Ritchie compiler, they are treated as integers.

=Spencer