Bug 1244 – Type of array length is unspecified

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2007-05-23T12:31:00Z
Last change time
2014-02-16T15:23:34Z
Keywords
spec
Assigned to
bugzilla
Creator
jlquinn
Blocks
677

Comments

Comment #0 by jlquinn — 2007-05-23T12:31:32Z
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 by matti.niemenmaa+dbugzilla — 2007-05-23T12:51:28Z
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 by bugzilla — 2007-07-01T14:07:55Z
Fixed DMD 1.018 and DMD 2.002