Thread (36 messages) 36 messages, 3 authors, 2016-06-15

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

From: Eric Sunshine <hidden>
Date: 2016-06-15 23:06:21

On Sun, Aug 30, 2015 at 2:51 AM, Karthik Nayak [off-list ref] wrote:
On Sun, Aug 30, 2015 at 9:00 AM, Eric Sunshine [off-list ref] wrote:
quoted
On Sat, Aug 29, 2015 at 10:12 AM, Karthik Nayak [off-list ref] wrote:
quoted
+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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help