Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!mcvax!ukc!its63b!xsimon From: xsimon@its63b.ed.ac.uk (Simon Brown) Newsgroups: comp.lang.c Subject: Re: Structure constants Message-ID: <667@its63b.ed.ac.uk> Date: Sat, 3-Oct-87 15:33:29 EDT Article-I.D.: its63b.667 Posted: Sat Oct 3 15:33:29 1987 Date-Received: Wed, 7-Oct-87 06:22:21 EDT References: <843@usfvax2.UUCP> Reply-To: simon@its63b.ed.ac.uk (Simon Brown) Organization: Computer Science Department, Edinburgh University Lines: 39 In article <843@usfvax2.UUCP> chips@usfvax2.UUCP (Chip Salzenberg) writes: >I suggested that X3J11 include structure constants in the draft standard: > > typedef struct { double r, i; } COMPLEX; > extern COMPLEX get_complex(), add_complex(); > main() > { > COMPLEX a, b; > a = get_complex_from_somewhere(); > b = add_complex(a, (COMPLEX){1.0, 1.0} ); > } Why leave it just at structure constants? Expanding it to arrays would be *much* more useful. For example, (int []){ 1, 4, 6, 78, -67 } ((FILE *)[]){ stdin, stdout } ... would all be sensible constant expressions. And of course, the character-string notation "string of chars" would just be shorthand for (char []) { 's','t','r','i','n','g',' ','o','f',' ','c','h','a','r','s','\0' } You can't beat good honest anonymous data! %{ Simon. %} -- ---------------------------------- | Simon Brown | UUCP: seismo!mcvax!ukc!{lfcs,its63b}!simon | Department of Computer Science | JANET: simon@uk.ac.ed.{lfcs,its63b} | University of Edinburgh, | ARPA: simon%lfcs.ed.ac.uk@cs.ucl.ac.uk | Scotland, UK. | or simon%its63b.ed.ac.uk@cs.ucl.ac.uk ---------------------------------- or simon%cstvax.ed.ac.uk@cs.ucl.ac.uk "Life's like that, you know"