From: Wolfgang Denk Date: Mon, 23 Mar 2009 23:46:23 +0100 Subject: [U-Boot] [PATCH 1/2] Fix OneNAND ipl to read CONFIG_SYS_MONITOR_LEN In-Reply-To: <49C80B99.5010808@freescale.com> References: <20090323212514.GA30976@ld0162-tx32.am.freescale.net> <20090323220948.DCC74832E406@gemini.denx.de> <49C80B99.5010808@freescale.com> Message-ID: <20090323224623.15E52832E406@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Scott, In message <49C80B99.5010808@freescale.com> you wrote: > > >>> + if (page < 2 && (onenand_readw(ONENAND_SPARERAM) != 0xffff)) > >>> + return 1; > >> Unnecessary parens. > > > > Where? I find them pretty useful. > > Around the second comparison. Why "if (a < b && (c != d))" and not "if > (a < b && c != d)", or if the parens are preferred, "if ((a < b) && (c > != d))"? Is it because "c" is a function call? Actually I'd probably write this as if ((page < 2) && (onenand_readw(ONENAND_SPARERAM) != 0xffff)) for consistency, but being lazy I guess I might use the same code as the OP. > OK -- I guess this is another of the unwritten points on which U-boot's > style deviates from that which is typical in Linux. Actually this is not some formal style (at least no rule that I know of), but personal taste :-) When I parse something like if (page < 2 && onenand_readw(ONENAND_SPARERAM) != 0xffff) I can eaisly see the "page < 2" expression because it is relatively short. But I have to look twice for the "onenand_readw(ONENAND_SPARE- RAM) != 0xffff" part because it is long and includes nested parens. So I feel tempted to make this easier to read by surrounding it with parens - like the OP did. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de I'm frequently appalled by the low regard you Earthmen have for life. -- Spock, "The Galileo Seven", stardate 2822.3