Is this a bug in iota?

Somedude lovelydear at mailmetrash.com
Thu Apr 19 01:14:39 PDT 2012


Le 19/04/2012 10:07, Jonathan M Davis a écrit :
> Having an assertion may be desirable, but the bug is in the usage of iota, not 
> iota itself. At best, the assertion would help indicate that the caller has a 
> bug. It's exactly the same as doing something like
> 
> for(size_t i = 3; cond; --i) {}
> 
> It's basic integer arithmetic. If you subtract from the minimum value that the 
> integral type will hold, then its value will wrap around to the maximum. So, 
> while adding an assertion would be desirable, I don't see how this could be 
> considered a bug in iota.
> 
> - Jonathan M Davis

I don't get it, for me iota has nothing to do with the problem, the
problem is in the implementation of popfront(), which should check
beforehand whether the range is empty, right ?


More information about the Digitalmars-d-learn mailing list