Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!brl-tgr!tgr!ucscc!galaxy@UCB-VAX From: galaxy%UCB-VAX@ucscc.UUCP Newsgroups: net.lang.c Subject: structure inits Message-ID: <7635@brl-tgr.ARPA> Date: Tue, 22-Jan-85 14:16:52 EST Article-I.D.: brl-tgr.7635 Posted: Tue Jan 22 14:16:52 1985 Date-Received: Thu, 24-Jan-85 19:17:57 EST Sender: news@brl-tgr.ARPA Organization: Ballistic Research Lab Lines: 30 Been wanting to know about local, global struct initialization. I haven't seen this Q addressed; also, this may be an item for all this discussion about standardization. Q: Why is it ok to init a structure in line #7 but not local like in line #12 ? --------------------------------------------------------------------- 1 struct a { 2 int size; 3 char stuff[25]; 4 short flag; 5 }; 6 7 struct a item = { 256000, "Whatever", 1 }; 8 9 any() 10 { 11 struct a item2 = item; /* no problem..... */ 12 struct a bomb = { 128, "str", 1 }; /* no go for local */ 13 } ---------------------------------------------------------------------- ...using cc(1) on a Vax 780, running 4.2 BSD Thanks. Replies: ucscc!galaxy@BERKELEY galaxy%c%ucsc@csnet-relay