Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!ai-lab!rice-chex!bson From: bson@rice-chex.ai.mit.edu (Jan Brittenson) Newsgroups: comp.lang.c Subject: Re: Request for Comments: Aggregate Assignment in C ... Message-ID: <12398@life.ai.mit.edu> Date: 13 Dec 90 05:02:20 GMT References: <77546@iuvax.cs.indiana.edu> Sender: news@ai.mit.edu Organization: nil Lines: 36 In article <77546@iuvax.cs.indiana.edu> mayer@iuvax.cs.indiana.edu (Mayer Goldberg) writes: >Consider the following program fragment: > >struct ag { > int a, b, c; >}; > >struct ag my_vec = {1, 2, 3}; > >This form of an "assignment" is permitted only during the >initialization of a variable (at compile time). Perhaps you should take a look at GNU C. Its aggregate initializer doesn't allow you to "skip" members, but I fid it much more useful than Pascal's WITH clause. /* Feed me to GCC! */ #include struct barf { int x, y; }; void print_barf(barfstuff) struct barf barfstuff; { printf("barf: x=%d, y=%d\n", barfstuff.x, barfstuff.y); } main() { print_barf( (struct barf) {2, 3} ); }