Re: [PATCH v14 05/13] ref-filter: add option to filter out tags, branches and remotes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 30, 2015 at 2:51 AM, Karthik Nayak <karthik.188@xxxxxxxxx> wrote:
> On Sun, Aug 30, 2015 at 9:00 AM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
>> On Sat, Aug 29, 2015 at 10:12 AM, Karthik Nayak <karthik.188@xxxxxxxxx> wrote:
>>> +int for_each_fullref_in(const char *prefix, each_ref_fn fn, void *cb_data, unsigned int broken)
>>
>> Booleans such as 'broken' are typically declared 'int' in this
>> codebase, rather than 'unsigned int'.
>
> But doesn't it make more sense to have it as unsigned, since its values are
> either 0 or 1?

In C, zero is false and any other value is true, so from that
viewpoint, the type doesn't matter much. However, beside being raw
instructions for the computer, code should ideally convey its
intention as clearly as possible to other programmers. 'int' for
boolean has been idiomatic since C's inception, thus is a good way to
do so, whereas 'unsigned int' is typically used for magnitude or bit
flags, thus is misleading.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]