Subject: Re: Making counts and lengths unsigned
To: Thor Lancelot Simon <tls@rek.tjls.com>
From: Allen Briggs <briggs@netbsd.org>
List: tech-kern
Date: 04/13/2006 22:52:08
On Thu, Apr 13, 2006 at 10:16:59PM -0400, Thor Lancelot Simon wrote:
> I propose to address the problem by making these members in our
> datastructures unsigned.  It's been pointed out that m.len might
> be another good candidate.

I'm not sure about this.  m_len is adjusted a good bit.  It shouldn't
ever be negative, and negative is probably just as bad in the code as
large-unsigned.  That's probably true for b_resid ond friends, too.
It might be more helpful from a debugging point of view to keep them
signed and assert for >= 0.  If you run into a problem, a DIAGNOSTIC
build would turn it up.

What would it help to have the values unsigned?  Would the code behave
any less unreasonably if it got a really huge value instead of a
negative value?

-allen

-- 
                  Use NetBSD!  http://www.NetBSD.org/