[Issue 3849] [missing error] Array literal length doesn't match

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 10 18:31:24 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=3849



--- Comment #12 from Stewart Gordon <smjg at iname.com> 2011-09-10 18:31:01 PDT ---
(In reply to comment #11)
> See also: 
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=144237
> 
> From that post:
> 
>> The solution is to add some symbol that explicitly marks the array 
>> as not complete, so both the compiler and the person that later 
>> reads the code knows some items are missing.
>> 
>> If no item is missing the compiler probably has to generate an 
>> error again:
>> 
>> int[2] arr = [1, 2, ...]; // compile-time error

I'm not sure about this.  I can imagine someone wanting it to work when the
length is a template parameter, in order to initialise only the first n members
where n is fixed.

And should we allow a value to precede the ..., like

    int[100] arr = [1, 2, 42...];

(all elements beyond the first two initialised to 42)?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list