Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1516006
| From | David Laight <David.Laight@ACULAB.COM> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: Coding Style: Reverse XMAS tree declarations ? |
| Date | 2016-11-07 12:10 +0100 |
| Message-ID | <sAPYl-2ha-5@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <szGDL-6CW-3@gated-at.bofh.it> <szKxH-Uo-11@gated-at.bofh.it> <szOhY-3pW-37@gated-at.bofh.it> <szQMO-4Qf-13@gated-at.bofh.it> <szThD-6we-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet David Miller <davem@davemloft.net> - 2016-11-03 21:00 +0100
Coding Style: Reverse XMAS tree declarations ? (was Re: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet) Joe Perches <joe@perches.com> - 2016-11-04 08:00 +0100
Re: Coding Style: Reverse XMAS tree declarations ? (was Re: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet) Lino Sanfilippo <lsanfil@marvell.com> - 2016-11-04 12:10 +0100
Re: Coding Style: Reverse XMAS tree declarations ? David Miller <davem@davemloft.net> - 2016-11-04 16:10 +0100
Re: Coding Style: Reverse XMAS tree declarations ? Joe Perches <joe@perches.com> - 2016-11-04 18:50 +0100
Re: Coding Style: Reverse XMAS tree declarations ? Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2016-11-04 21:30 +0100
RE: Coding Style: Reverse XMAS tree declarations ? David Laight <David.Laight@ACULAB.COM> - 2016-11-07 12:10 +0100
Re: Coding Style: Reverse XMAS tree declarations ? (was Re: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet) Randy Dunlap <rdunlap@infradead.org> - 2016-11-04 18:10 +0100
Re: Coding Style: Reverse XMAS tree declarations ? (was Re: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet) David VomLehn <vomlehn@texas.net> - 2016-11-04 22:00 +0100
Re: Coding Style: Reverse XMAS tree declarations ? (was Re: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet) Michael Ellerman <mpe@ellerman.id.au> - 2016-11-07 09:10 +0100
Re: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet David Miller <davem@davemloft.net> - 2016-11-07 17:00 +0100
Re: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet David Miller <davem@davemloft.net> - 2016-11-07 17:40 +0100
RE: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet Madalin-Cristian Bucur <madalin.bucur@nxp.com> - 2016-11-08 00:40 +0100
RE: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet Madalin-Cristian Bucur <madalin.bucur@nxp.com> - 2016-11-08 08:30 +0100
RE: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet Madalin-Cristian Bucur <madalin.bucur@nxp.com> - 2016-11-07 17:00 +0100
RE: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet Madalin-Cristian Bucur <madalin.bucur@nxp.com> - 2016-11-09 18:20 +0100
Re: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet David Miller <davem@davemloft.net> - 2016-11-09 18:20 +0100
csiph-web