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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 181 - Spec contradicts itself on whether an array may be partially initialized
Summary: Spec contradicts itself on whether an array may be partially initialized
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D1 (retired)
Hardware: All All
: P2 normal
Assignee: Walter Bright
URL: http://www.digitalmars.com/d/arrays.html
Keywords: spec
Depends on:
Blocks:
Reported: 2006年06月07日 07:22 UTC by Stewart Gordon
Modified: 2021年05月28日 01:17 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Stewart Gordon 2006年06月07日 07:22:27 UTC
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 Walter Bright 2006年06月30日 20:28:17 UTC
Fixed DMD 0.162 (changed documentation)
Comment 2 Stewart Gordon 2006年11月16日 18:35:19 UTC
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 Stewart Gordon 2006年11月16日 19:23:39 UTC
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 Stewart Gordon 2006年11月18日 07:03:16 UTC
Oops, wrong issue....
*** This bug has been marked as a duplicate of 508 ***
Comment 5 Dlang Bot 2021年05月28日 01:17:26 UTC
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 


AltStyle によって変換されたページ (->オリジナル) /