Re: unsigned interger overflow

2013-10-02 Thread Alexandr Druzhinin
02.10.2013 12:41, Jonathan M Davis пишет: On Wednesday, October 02, 2013 12:32:24 Alexandr Druzhinin wrote: 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

Re: unsigned interger overflow

2013-10-02 Thread Jonathan M Davis
On Wednesday, October 02, 2013 11:15:00 monarch_dodra wrote: > Last time I read TDPL, I *seem* to remember that it stated that D > targeted *exclusively* 2's complement architechture. So I'd > conclude that, even if it is not *specified*, the only logical > behavior for signed under/over flow, is t

Re: unsigned interger overflow

2013-10-02 Thread monarch_dodra
On Wednesday, 2 October 2013 at 08:51:43 UTC, qznc wrote: On Wednesday, 2 October 2013 at 05:41:50 UTC, Jonathan M Davis wrote: On Wednesday, October 02, 2013 12:32:24 Alexandr Druzhinin wrote: Is it safe to replace code: uint index; // do something index++; if(index == index.max) index = inde

Re: unsigned interger overflow

2013-10-02 Thread qznc
On Wednesday, 2 October 2013 at 05:41:50 UTC, Jonathan M Davis wrote: On Wednesday, October 02, 2013 12:32:24 Alexandr Druzhinin wrote: 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

Re: unsigned interger overflow

2013-10-01 Thread Jonathan M Davis
On Wednesday, October 02, 2013 12:32:24 Alexandr Druzhinin wrote: > 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 chang

unsigned interger overflow

2013-10-01 Thread Alexandr Druzhinin
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