[Issue 16149] foreach_reverse can't handle index variable of type int

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jun 10 04:59:25 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16149

Ketmar Dark <ketmar at ketmar.no-ip.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ketmar at ketmar.no-ip.org

--- Comment #1 from Ketmar Dark <ketmar at ketmar.no-ip.org> ---
...and, techincally, it shouldn't.

first case (roughly) does: `int i; while (i < s.length) ...` which is perfectly
legal. but second does: `int i = s.length;`, which requires conversion from
`size_t` (of type `ulong` on 64-bit arch) to `int`, which is illegal.

i'd say that first case should be forbidden too, but the seconds case -- in my
opinion -- doesn't require fixing.

--


More information about the Digitalmars-d-bugs mailing list