dmd foreach loops throw exceptions on invalid UTF sequences, use replacementDchar instead
Adam D Ruppe
destructionator at gmail.com
Thu Nov 4 12:17:18 UTC 2021
On Thursday, 4 November 2021 at 07:51:11 UTC, Elronnd wrote:
> What is (potentially) questionable imo is that given foreach
> (c; a), c will be inferred to be dchar; you have to explicitly
> ask for char. Perhaps that default should be reversed. (This
> will definitely break code, though, and may not be worth it.)
That's not true. It will always be the type of the thing:
void main() {
foreach(a; "test")
pragma(msg, typeof(a)); // immutable(char) NOT
dchar
}
More information about the Digitalmars-d
mailing list