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!genrad!panda!talcott!harvard!seismo!brl-tgr!tgr!lcc.niket@UCLA-LOCUS.ARPA From: lcc.niket@UCLA-LOCUS.ARPA (Niket K. Patwardhan) Newsgroups: net.lang.c Subject: C standard for initializations Message-ID: <11661@brl-tgr.ARPA> Date: Thu, 18-Jul-85 09:30:02 EDT Article-I.D.: brl-tgr.11661 Posted: Thu Jul 18 09:30:02 1985 Date-Received: Sat, 20-Jul-85 04:06:44 EDT Sender: news@brl-tgr.ARPA Lines: 45 Date: Mon, 15 Jul 85 12:33:31 PDT From: Niket K. Patwardhan To: info-c Subject: C standard on initialization. I would like this to get transferred to the C standards group as well as see comments on this proposal. It has always seemed to me extremely lame that C has no way of specifying that a particular value is to be repeated N times, without actually typing out the value N times. Although the draft standard permits initialization of sub-aggregates via some pretty fancy grouping, it still says nothing about duplicated values. The only practical way of initializing a large data structure to something other than all NULLs is to actually write some code to do it. What I would like to see is this ::= { } { } { , } If the grammar is too hard to parse, or too unnatural, the constant expression can follow the initializer list in braces. The semantics is as follows: constant-expression has to evaluate to a positive integer. { } is equivalent to { } , { } , ...... the right number of times. or { , ,....... } or some variation thereof. On second thought the post-fix constant seems more natural, it having been often used in documentation with the constant being a superscript. I would consider a scheme that allowed a single constant to be repeated insufficient. It is necessary that patterns can be specified as occurring N times.