Strange behavior of iota

Era Scarecrow rtcvb32 at yahoo.com
Wed Feb 16 02:51:32 UTC 2022


On Tuesday, 15 February 2022 at 22:24:53 UTC, bachmeier wrote:
> On Tuesday, 15 February 2022 at 22:02:13 UTC, Adam D Ruppe 
> wrote:
>> for(a = v.length; a > cast(size_t) -1, a += -1)
>
> After looking at the documentation and seeing CommonType!(int, 
> uint) is uint, I have to say that iota's behavior doesn't make 
> much sense.

Unless it's almost always intended to go up and stay positive?

Not that it can't be modified to take all those cases in, hitting 
64bit there's little reason you can't just use long,long for the 
arguments.


More information about the Digitalmars-d-learn mailing list