Path: utzoo!attcan!uunet!steinmetz!davidsen
From: davidsen@steinmetz.ge.com (William E. Davidsen Jr)
Newsgroups: comp.lang.c
Subject: Re: Help me cast this!: Ultrix 2.x bug
Keywords: pointer to array of struct
Message-ID: <10800@steinmetz.ge.com>
Date: 11 May 88 16:27:25 GMT
References: <294@fedeva.UUCP> <1451@iscuva.ISCS.COM> <11344@mimsy.UUCP> <386@m3.mfci.UUCP> <11371@mimsy.UUCP> <392@m3.mfci.UUCP>
Reply-To: davidsen@crdos1.UUCP (bill davidsen)
Organization: General Electric CRD, Schenectady, NY
Lines: 22

There is an argument for allowing &a. If you have a typedef and don't
need the user to be aware of the inner workings, you would have to know
if the typedef evaluated to an array, to prevent warnings.

Consider:
  typedef int ary[10];		/* system dependent header	*/

  ary mystuff;			/* user declaration		*/
  do_init(&mystuff);		/* warning here			*/

If the user just uses 'mystuff' without the '&' the program must be
rewritten if the internal structure of type 'ary' changes. The solution
is to force a structure, thus:
  typedef struct { int vect[10]; } ary;

Then either the item or the address can be used, and only the procedures
which work with the contents of the structure need to know its contents.

-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me