Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: syssrc/sys/kern
At 10:06 PM 10/2/2002, itojun%iijlab.net@localhost wrote:
>> Modified Files:
>> syssrc/sys/kern: kern_resource.c
>>
>> Log Message:
>> check negative arg. from openbsd
>Due to the `(u_int)' cast -- which I added just about 5 years ago --
>this code already handled negative arguments correctly. Your change
>is a noop.
ok, but isn't it better to explicitly check
if (which < 0 || which >= MAX)
return EINVAL
than
if ((u_int)which >= MAX)
return EINVAL
from readability/clarity?
No. It's slower and not if you don't know about signedness/unsigness
of number, you shouldn't be doing kernel programming.
--
Matt Thomas Internet: matt%3am-software.com@localhost
3am Software Foundry WWW URL: http://www.3am-software.com/bio/matt/
Cupertino, CA Disclaimer: I avow all knowledge of this message
Home |
Main Index |
Thread Index |
Old Index