On 06/28/2012 08:58 AM, Markus Armbruster wrote:
>>>
>>> Better code is an argument only if the effect can be demonstrated.
>>
>> I don't know even for which compilers or CPUs this is true so it's
>> unlikely I could demonstrate it. However, googling finds a few
>> articles in defense of this.
> 
> Hearsay.  Your honor, I rest my case :)

On x86_64, conversion from unsigned to unsigned long takes zero
instructions, but conversion from int to long takes one instruction.  So
expressions like a[i] are one instruction shorter if the index is unsigned.

unsigned is also slightly safer from a security perspective, since you
only need to consider overflow, not underflow.

I used to be an int fan but I have been converted.  My fingers still
prefer int though.

-- 
error compiling committee.c: too many arguments to function



Reply via email to