Checksum: 54582 Lines: 28 Path: utzoo!sq!msb From: msb@sq.uucp (Mark Brader) Date: Fri, 4-Mar-88 20:43:25 EST Message-ID: <1988Mar4.204325.19658@sq.uucp> Newsgroups: comp.lang.c Subject: Re: The D Programming Language (was: Still more new operators) Summary: no special syntax needed for first-class arrays References: <11702@brl-adm.ARPA> <2550047@hpisod2.HP.COM> Reply-To: msb@sq.UUCP (Mark Brader) Organization: SoftQuad Inc., Toronto Dave Decot (decot@hpisod2.HP.COM) writes: > Array first-class-ness and aggregate constants could be easily provided > within C (not that I want to discourage D-zigners; it's a meritorious idea). > > The basic ideas are that "a[]" is an array lvalue, and that aggregate > constants are natively typeless and must always be either cast or assigned > to the appropriate type. Two examples follow. The a[] syntax isn't needed, any more than you need a special syntax for struct assignment. Dave's first example revised: int thing(i, a, b)[2] int i, a[2], b[2]; { int val[2]; ... return val; } Since the type to be returned is int[2], the value "val" is left as an int[2] type item and not converted to int *. The one thing that would have to change, of course, is the present rule that the formal parameter declaration int a[2] means int *a. As I have said before, this rule change could be introduced into the language along with prototype syntax. Mark Brader, utzoo!sq!msb, msb@sq.com C unions never strike!