0 < negative loop condition bug or misunderstanding on my part
James Miller
james at aatch.net
Wed Mar 7 00:58:35 PST 2012
On 7 March 2012 19:30, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
>> On 03/06/2012 10:05 PM, ixid wrote:
>> > Ah, thank you, so it's wrapping. That seems like a bad idea, what is
>> > the benefit to size being unsigned rather than signed?
>> > This case would seem like one where allowing negatives is clearly
>> > better and more intuitive.
Because you don't describe things as -5 metres tall, so you don't
describe things as -1024 bytes long. size_t makes sense unsigned
because negatives make no sense for size.
However, if you cast array.length to an int, it may work, haven't tested it.
--
James Miller
More information about the Digitalmars-d-learn
mailing list