[net.lang.c] automatic aggregate initialization

decot@hpda.UUCP (Dave Decot) (05/31/85)

> its an implementation nightmare to have to init structures/arrays/unions
> Remember automatic means that this stuff is on the stack, and your subroutine
> will have to spend time doing the init (which should have just been static)
> I agree it should be allowed but I won't use it.
> 
> Hedley Rainnie.

The language already allows you to declare automatic structures/arrays/unions.
They do go on the stack.  You probably use them whenever you call stat(2).

To implement automatic initialization, pretend it's static, and generate the
value somewhere at the beginning.  Whenever the function or block is entered,
just copy the block of memory into the stack where it's supposed to be.
Simple.  This is an easy way to do aggregate constants, too, but nobody
seems to like that idea.

Dave Decot  /  Hewlett-Packard Company  /  Data Systems Division
decvax!ucbvax!hpda!decot