unsigned int in for loops
eles
eles at eles.com
Fri Feb 4 08:14:29 PST 2011
hi everybody,
recently i was hit by an old-known programming error, using unsigned int in for
loops could get into infinite traps:
http://stackoverflow.com/questions/665745/whats-the-best-way-to-do-a-reverse-
for-loop-with-an-unsigned-index
so, i D (1 or 2) is counter-attacking in some way (for example, disabling
implicit casting of (-1) to UINT_MAX).
cordially,
eles.
PS i really like being able to use an unsigned int for those loops, both for
logical and for programming (large values of the loop index), while still
avoiding such traps. thanks.
More information about the Digitalmars-d-learn
mailing list