In D, array length is specified to be size_t, which allows for arrays up to the size of memory. However, the indexing form of foreach only permits an int or uint as the index variable. This will likely result in a silent bug used on an array w/ more than 4G elements in a 64 bit environment. For example: char[] x; x.length = 0x2_0000_0000L; // fill the array foreach (int i, char c; x) do_something(i, c); foreach should be able to support a size_t in the index variable location.
I put this bug against DMD, but it's really a language definition issue. It might make sense to provide a separate component to separate issues with the language spec from those with the compiler implementation.
I think language specification issues are usually filed against dmd and marked with the 'spec' keyword.
Fixed dmd 1.029 and 2.013
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル