1244 – Type of array length is unspecified

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1244 - Type of array length is unspecified
Summary: Type of array length is unspecified
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: 677
Show dependency tree / graph
Reported: 2007年05月23日 12:31 UTC by Jerry Quinn
Modified: 2014年02月16日 15:23 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 Jerry Quinn 2007年05月23日 12:31:32 UTC
The data type of the array.length property is unspecified. Is it int, uint, long, ulong? C++ uses an unsigned value, but that makes writing loops like
for (int i=0; i < arr.length; i++)
not work without an explicit cast. If you choose int, then you can't represent arrays larger than 2GB.
Whatever the choice is, the choice needs to be made explicit. 
I was exploring D for an app that can have very large arrays, hence the question.
Comment 1 Matti Niemenmaa 2007年05月23日 12:51:28 UTC
It's mentioned on the portability page ( http://www.digitalmars.com/d/portability.html ) that the length is of type size_t, but it would be good to have it on the arrays page as well.
Comment 2 Walter Bright 2007年07月01日 14:07:55 UTC
Fixed DMD 1.018 and DMD 2.002


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