[U-Boot] Continuation line alignment
Scott Wood
scottwood at freescale.com
Tue Nov 8 00:02:28 CET 2011
On 11/07/2011 04:05 PM, Wolfgang Denk wrote:
> Dear Gerlando Falauto,
>
> In message <4EB84859.6000906 at keymile.com> you wrote:
>>
>> -int _do_env_set (int flag, int argc, char * const argv[])
>> +int env_check_apply(const char *name, const char *oldval,
>> + const char *newval, int flag)
>>
>>> Please use only TAB for indentation. Please fix globally.
>>
>> From fs/ubibfs/ubifs.h:
>
> Never ever use examples from other code to argument your's was right -
> the example you chose might be wrong as well.
>
>> Could you please provide some examples as to what would be the correct
>> coding style for function declarations and/or function calls that spawn
>> on multiple lines? I could not find anything on the topic.
>
> http://www.denx.de/wiki/U-Boot/CodingStyle:
>
> Use TAB characters for indentation and vertical alignment, not
> spaces
It is impossible to align this nicely with tabs alone. Such alignment
is not just an isolated example, but quite common in both the Linux
kernel and U-Boot.
Grep for a tab followed by a space...
>> + if (himport_ex(&env_htab, (char *)default_environment,
>> + sizeof(default_environment), '\0', 0,
>> + 0, NULL, apply_function) == 0) {
>>
>> What should be the right indentation?
>
> In any case it makse no sense to have the 2nd and 3rd line indented
> differently, right?
They generally shouldn't be different from each other, but that doesn't
answer the question of what it should look like.
Documentation/CodingStyle calls for something like this:
if (himport_ex(&env_htab, (char *)default_environment,
sizeof(default_environment), '\0',
0, 0, NULL, apply_function) == 0) {
...but judging by how common it is, many people find this nicer:
if (himport_ex(&env_htab, (char *)default_environment,
sizeof(default_environment), '\0',
0, 0, NULL, apply_function) == 0) {
I vote for allowing it, if anyone's counting.
-Scott
More information about the U-Boot
mailing list