Bug 181 – Spec contradicts itself on whether an array may be partially initialized

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2006-06-07T07:22:27Z
Last change time
2021-05-28T01:17:26Z
Keywords
spec
Assigned to
Walter Bright
Creator
Stewart Gordon

Comments

Comment #0 by smjg — 2006-06-07T07:22:27Z
Static Initialization of Static Arrays The spec gives this code sample: int[3] a = [ 1:2, 3 ]; // a[0] = 0, a[1] = 2, a[2] = 3 Two paragraphs below it is the statement: "If any members of an array are initialized, they all must be." On this basis, the code sample is invalid. There has been some debate over which should be correct: the code sample or the requirement to initialize every element when using an array initializer. My vote goes to the latter being the correct one, in which case the code sample needs to be changed to one that's valid, e.g. int[3] a = [ 1:2, 3, 0:0 ]; // a[0] = 0, a[1] = 2, a[2] = 3
Comment #1 by bugzilla — 2006-06-30T20:28:17Z
Fixed DMD 0.162 (changed documentation)
Comment #2 by smjg — 2006-11-16T18:35:19Z
It appears that Walter's assorted copies of the documentation have become out of sync. The contradiction has come right back again in exactly the same form.
Comment #3 by smjg — 2006-11-16T19:23:39Z
Resurfaced as issue 511. Duping this to that, considering that this has been logged as fixed. *** This bug has been marked as a duplicate of 511 ***
Comment #4 by smjg — 2006-11-18T07:03:16Z
Oops, wrong issue.... *** This bug has been marked as a duplicate of 508 ***
Comment #5 by dlang-bot — 2021-05-28T01:17:26Z
dlang/dlang-bot pull request #275 "Mention all approving reviewers in the commit message" was merged into master: - 21336e502f97e582a6cb4deab5d232c476060c5f by Vladimir Panteleev: Mention all approving reviewers in the commit message Fixes #181. https://github.com/dlang/dlang-bot/pull/275