Strange behavior of iota
Adam D Ruppe
destructionator at gmail.com
Tue Feb 15 22:02:13 UTC 2022
On Tuesday, 15 February 2022 at 21:48:29 UTC, bachmeier wrote:
> writeln(iota(v.length,-1,-1));
This would be like
for(a = v.length; a > cast(size_t) -1, a += -1)
That (cast(size_t) -1) is the same as thing.max, meaning a will
never be greater than it.
> Why does the first argument to iota have to be an int, and why
> isn't there an error message when I pass something else?
Yeah, perhaps when you give it that -1 as the second argument it
should see it is signed and throw something.
More information about the Digitalmars-d-learn
mailing list