From owner-svn-src-head@FreeBSD.ORG Thu Nov 27 18:22:05 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DDA31065673; Thu, 27 Nov 2008 18:22:05 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 40A958FC0A; Thu, 27 Nov 2008 18:22:04 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id E467E6D449; Thu, 27 Nov 2008 18:22:03 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id C58DF844A7; Thu, 27 Nov 2008 19:22:03 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "M. Warner Losh" References: <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> <8663m94g30.fsf@ds4.des.no> <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> <20081127.105534.188222755.imp@bsdimp.com> Date: Thu, 27 Nov 2008 19:22:03 +0100 In-Reply-To: <20081127.105534.188222755.imp@bsdimp.com> (M. Warner Losh's message of "Thu, 27 Nov 2008 10:55:34 -0700 (MST)") Message-ID: <86ej0x112s.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, ivoras@gmail.com Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 18:22:05 -0000 "M. Warner Losh" writes: > This is a K&R level C construct. > > It is discouraged in style(9) because it makes it hard to find > declarations. However, it is used in the kernel in a number of > places. > > I personally really dislike the style (and yes, I know all the > arguments for it). If you really want something that complex inside a > block to need block scoped variables, then that really argues for a > function oft times... There is one particular situation where it is very convenient: int foo(struct sockaddr *sa) { switch (s->sa_family) { case AF_INET: { struct sockaddr_in *sin =3D (struct sockaddr_in *)sa; /* ... */ break; } case AF_INET6: { struct sockaddr_in6 *sin6 =3D (struct sockaddr_in6 *)sa; /* ... */ break; } case AF_UNIX: { /* you get the idea */ } default: /* ... */ } } DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no