Thread overview
[Issue 8533] New: Postfix and prefix declarations of static multidimensional arrays aren't equivalent
Aug 10, 2012
timon.gehr@gmx.ch
August 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8533

           Summary: Postfix and prefix declarations of static
                    multidimensional arrays aren't equivalent
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: FatalError@trash-mail.com


--- Comment #0 from FatalError@trash-mail.com 2012-08-10 10:16:19 PDT ---
I found this in v2.059 and v2.060.
Consider these 2 programs:
Pre:
void main()
{
  int m[3][2];
  foreach(i;0..3)
  {
    m[0][i]=0;
    m[1][i]=1;
  }
}

Post:
void main()
{
  int [3][2]m;
  foreach(i;0..3)
  {
    m[0][i]=0;
    m[1][i]=1;
  }
}

They only differ in the declaration of m.
Pre throws a range violation, but Post does not. This is a bug, because the
documentation for rectangular arrays claims
int [3][2]m;
int m[3][2];
to be equivalent declarations.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8533


timon.gehr@gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |timon.gehr@gmx.ch
         Resolution|                            |INVALID


--- Comment #1 from timon.gehr@gmx.ch 2012-08-10 10:33:29 PDT ---
The documentation doesn't seem to state the equivalence of
int[3][2] m;
int m[3][2];

and indeed the declarations are not equivalent.

int[3][2] m;
int m[2][3];

would be equivalent.

If there is a place in the documentation that does state the first equivalence, please file a bug against the documentation.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8533



--- Comment #2 from FatalError@trash-mail.com 2012-08-10 11:30:16 PDT ---
Oh, yes it was an oversight on my side, sorry.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------