[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB021646E@AcuExch.aculab.com>
Date: Mon, 7 Nov 2016 11:00:49 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Lino Sanfilippo' <LinoSanfilippo@....de>,
Joe Perches <joe@...ches.com>,
David Miller <davem@...emloft.net>,
"lsanfil@...vell.com" <lsanfil@...vell.com>
CC: "madalin.bucur@....com" <madalin.bucur@....com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"corbet@....net" <corbet@....net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"oss@...error.net" <oss@...error.net>,
"ppc@...dchasers.com" <ppc@...dchasers.com>,
"pebolle@...cali.nl" <pebolle@...cali.nl>,
"joakim.tjernlund@...nsmode.se" <joakim.tjernlund@...nsmode.se>,
Randy Dunlap <rdunlap@...radead.org>
Subject: RE: Coding Style: Reverse XMAS tree declarations ?
From: Lino Sanfilippo
> Sent: 04 November 2016 20:07
...
> In this case it is IMHO rather the declaration + initialization that makes
> "bar" hard to find at one glance, not the use of RXT. You could do something like
>
> [longish list of reverse xmas tree identifiers...]
> struct foobarbaz *qux;
> struct foo *bar;
>
> bar = longish_function(args, ...);
>
> to increase readability.
>
> Personally I find it more readable to always use a separate line for initializations
> by means of functions (regardless of whether the RXT scheme is used or not).
I find it best to only use initialisers for 'variables' that are (mostly) constant.
If something need to be set to NULL in case a search fails, set it to NULL
just before the loop.
Don't put initialisation on the declaration 'because you can'.
Difficulty in spotting the type of a variable is why (IMHO) you should
but all declarations at the top of a function
(except, maybe, temporaries needed for a few lines).
David
Powered by blists - more mailing lists