lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 18 Jul 2007 17:24:29 +0200 (CEST)
From:	Jan Engelhardt <jengelh@...putergmbh.de>
To:	Greg KH <greg@...ah.com>
cc:	Andrew Morton <akpm@...ux-foundation.org>,
	"Ed L. Cashin" <ecashin@...aid.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] stacked ifs (was Re: [PATCH 02/12] handle multiple
 network paths to AoE device)


On Jul 16 2007 17:01, Greg KH wrote:
>> 
>> > > ugh.  Do this:
>> > > 
>> > > 	do {
>> > > 		if (t == d->htgt)
>> > > 			continue;
>> > > 		if (!(*t)->ifp->nd)
>> > > 			continue;
>> > > 		if ((*t)->nout >= (*t)->maxout)
>> > > 			continue;
>> > > 			
>> > > 		<stuff>
>> > > 	} while (++t ...)
>> > 
>> > Do you think the "stacked ifs" in the first version above could be
>> > accepted as a convenient extension to the K&R-based conventions in
>> > Documentation/CodingStyle?
>> 
>> Maybe.  I don't recall seeing any kernel code which uses that convention:
>> everyone uses &&.  So personally I'd prefer to see kernel code stick to the
>> one convention, given that there is not, afacit, any significant advantage
>> to the alternative one.
>
>I agree, let's stick with the convention we already have and use
>instead.

Yup. Either the "do this" (see above) or the "&&" variant, though, the latter
can become quite nested or long.

[ In fact, if you have
  void function(struct something *arg)
  {
  	if (arg != NULL) {
  		lots_of_code;
  	}
  }
  it is perhaps better to write as
  {
  	if (arg == NULL)
  		return;
  	lots_of_code;
  }
  since that reduces the indent by at least one. ]


	Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ