From: Amitha P. <pe...@cs...> - 2006-01-08 18:15:12
|
On Fri 06 Jan 2006, Miguel A. Figueroa-Villanueva wrote: > Another option is to allow index_ to be out of range and initialize it > to -1 (no more unsigned int) [...] For the record, initializing the counter to unsigned(-1) is well-defined, and works as expected: unsigned(-1) + unsigned(1) == unsigned(0), and is guaranteed by the standard. Of course, since unsigned follows modulo arithmetic, unsigned(-1) > unsigned(0), which implies more care in dealing with the value. I personally prefer unsigned values, but others have strong opposing opinons. Amitha. |