[PATCH 1 of 6] C modules: don't mix tabs and spaces
Nicolas Dumazet
nicdumz at gmail.com
Thu Aug 27 09:04:07 CDT 2009
2009/8/27 Maxim Dounin <mdounin at mdounin.ru>:
>> Use tabs seems it is apparently the standard.
>
> I believe it's linux kernel style which is used for C code. Matt
> wrote about it some time ago.
I probably haven't been around for long enough ;)
> [...]
>
>> @@ -253,7 +253,7 @@
>> pos = (struct pos *)calloc(bn ? bn : 1, sizeof(struct pos));
>> /* we can't have more matches than lines in the shorter file */
>> l.head = l.base = (struct hunk *)malloc(sizeof(struct hunk) *
>> - ((an<bn ? an:bn) + 1));
>> + ((an<bn ? an:bn) + 1));
>
> Here is a good illustration why tabs shouldn't be used to pad
> continuation lines (are you using tabwidth=4 in your editor? try
> default - 8). Even if tabs used for indenting.
Yuck. Looks ugly indeed.
I think it's a good illustration of why we should avoid at all cost
mixing tabs and
spaces. Either pick all-spaces, either pick all-tabs.
Using spaces for continuation lines is not the magic solution: if the
previous line is indented using tabs,
then the overall render still depends on editor-specific
tabwidth/tabexpand value
But I'm young and innocent. Don't feed me to the trolls -- yet :)
>
> [...]
>
>> diff --git a/mercurial/diffhelpers.c b/mercurial/diffhelpers.c
>> --- a/mercurial/diffhelpers.c
>> +++ b/mercurial/diffhelpers.c
>> @@ -74,7 +74,7 @@
>> todob = lenb - PyList_Size(b);
>> num = todoa > todob ? todoa : todob;
>> if (num == 0)
>> - break;
>> + break;
>
> This one looks like real style fix.
>
> [...]
>
> Maxim Dounin
>
--
Nicolas Dumazet — NicDumZ [ nɪk.d̪ymz ]
More information about the Mercurial-devel
mailing list