bug in grammar with ?:

Dennis dkorpel at gmail.com
Tue Sep 17 18:26:13 UTC 2019

On Tuesday, 17 September 2019 at 18:16:41 UTC, Brett wrote:
> All it takes is forgetting this one time and one could have 
> serious bugs(if the condition is complex and resolves in a hard 
> to detect way it could produce such cases, rare but possible).

To be honest, your entire loop is one big code smell.

for(ulong i = len - 1; i >= ((true) ? 0 : 1); i--)

if len = 0, i will underflow and be initialized to ulong.max.
i >= 0 is vacuously true for an unsigned integer, resulting in 
and endless loop

I don't know your original situation, but if you can, please use 
foreach or foreach_reverse.

More information about the Digitalmars-d mailing list