unsigned interger overflow

Alexandr Druzhinin drug2004 at bk.ru
Tue Oct 1 22:32:24 PDT 2013


Is it safe to replace code:

uint index;
// do something
index++;
if(index == index.max)
	index = index.init;

by the following code
uint index;
// do something
index++; /// I use unsigned int so uint.max changed to 0 automagically

Thanks in advance



More information about the Digitalmars-d-learn mailing list