array and structure initialization

mat at hou5e.UUCP mat at hou5e.UUCP
Sun Jun 12 13:42:43 AEST 1983

	regarding the 

struct foo
	char	*f_slist[];
	int	f_code;

This sort of cruft went away with v6.  Remember that structures can be
assigned nowadays.  This requires that the structure length be stable
for a given type of structure.

Unfortuneately, it gets a little messy to do what you want, but this should
do it

char	*f_list[]

struct	foo
	char	**f_list;
	int	f_code;
}	bar[]
	{ f_list, 1 },
	{   . . .   },

	  .  .  .
If you have access to the v7 or later source for the Ritchie C compiler
you may want to look at the output of the table encoding program.
I can't say any more about that, but you have got a nuisance problem --
there is no general way to write constants for arbitrar compound objects
except in a few (admittedly VERY useful) cases in initializers.  ADA (TM
of DOD and all that rot) does solve this problem, but the fairly general
solution is probably part of what gives the language it's horrid complexity.

						Mark Terribile

More information about the Comp.lang.c mailing list