[Issue 3652] Allow explicit and implicit casting of dynamic array slices of known size to static array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 1 02:30:41 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=3652


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2013-03-01 02:30:36 PST ---
Partial implementation:
https://github.com/D-Programming-Language/dmd/pull/1705

(In reply to comment #0)
>     float[] xs = read_floats_from_file();
>     foreach (i; 0 .. xs.length-4) {
>          foo(xs[i .. i+4]);
>     }

In this case, detecting length == 4 in compile time is difficult with
complicated cases. Consider:

   foo(xs[(i*4+10)/2 .. (i*8>>1)/2+9]);
   // lwr = (i*4 + 10)/2 = i*4/2 + 10/2            = (i*2+5)
   // upr = (i*8>>1)/2 + 5 = (i*4/2) + 5 = i*2 + 9 = (i*2+5) + 4

So this is not supported in my pull request.

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


More information about the Digitalmars-d-bugs mailing list