From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Tue, 23 Mar 2010 07:23:15 +0100 Subject: [U-Boot] preferred style? In-Reply-To: References: Message-ID: <4BA85E53.90404@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 Hello Frans, Frans Meulenbroeks wrote: > I've been peeking at optimizing a little bit more in i2c, and I bumped > into a stylish question: > > I see function prototypes like: > static int > mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) > > and also > int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) > > A few questions on this: > > is the preferred place of the type on a separate line (like for > mod_i2c_mem) or on the same line as the function (as for > do_i2c_probe)? Hmm.. I prefer to have this in one line, and think, this is the way to go ... > Also do_i2c_probe and friends are mentioned in the subcmd table and > are not used outside the file. (at least do_i2c_probe isn't, didn't > check the others yet) > So wouldn't it be preferable to have them static too? Yep. I checked this for all do_i2c_* functions, they should be all static. Thanks for detecting this. > Furthermore I noticed: &cmd_i2c_sub[0]. Is this preferred above just > writing cmd_i2c_sub (so without & and [0]). I prefer with & and [0] bye Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany