Thread overview
[Issue 1244] New: Type of array length is unspecified
May 23, 2007
d-bugmail
May 23, 2007
d-bugmail
Jul 01, 2007
d-bugmail
May 23, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1244

           Summary: Type of array length is unspecified
           Product: D
           Version: 1.010
          Platform: PC
               URL: http://www.digitalmars.com/d/arrays.html
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: www.digitalmars.com
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: jlquinn@us.ibm.com


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.


-- 

May 23, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1244


deewiant@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |677
              nThis|                            |
           Keywords|                            |spec
         OS/Version|Linux                       |All
           Platform|PC                          |All




------- Comment #1 from deewiant@gmail.com  2007-05-23 12:51 -------
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.


-- 

July 01, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1244


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from bugzilla@digitalmars.com  2007-07-01 14:07 -------
Fixed DMD 1.018 and DMD 2.002


--