From owner-freebsd-hackers@FreeBSD.ORG Sat May 2 04:03:30 2009 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5615B106564A for ; Sat, 2 May 2009 04:03:30 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: from kiwi-computer.com (gw1.SetFilePointer.com [63.224.10.6]) by mx1.freebsd.org (Postfix) with SMTP id DE8C88FC08 for ; Sat, 2 May 2009 04:03:29 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: (qmail 95396 invoked by uid 2001); 30 Apr 2009 23:36:48 -0000 Date: Thu, 30 Apr 2009 18:36:48 -0500 From: "Rick C. Petty" To: "M. Warner Losh" Message-ID: <20090430233648.GA95360@keira.kiwi-computer.com> References: <49F4070C.2000108@gmx.de> <20090428114754.GB89235@server.vk2pj.dyndns.org> <20090430.090226.1569754707.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090430.090226.1569754707.imp@bsdimp.com> User-Agent: Mutt/1.4.2.3i Cc: freebsd-hackers@FreeBSD.org Subject: Re: C99: Suggestions for style(9) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rick-freebsd2008@kiwi-computer.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2009 04:03:30 -0000 On Thu, Apr 30, 2009 at 09:02:26AM -0600, M. Warner Losh wrote: > > This is the biggest one, and I think it may be too soon. Also, we > need to be careful on the initialization side of things because we > currently have a lot of code that looks like: > > > struct foo *fp; > struct bar *bp; > > fp = get_foo(); > if (!fp) return; > bp = fp->bp; > > this can't easily be translated to the more natural: > > struct foo *fp = get_foo(); > struct bar *bp = fp->bp; > > since really you'd want to write: > > struct foo *fp = get_foo(); > if (!fp) return; > struct bar *bp = fp->bp; > > which isn't legal in 'C'. I thought we were talking about C99, in which case this is perfectly legal. I certainly use it all the time in my C99 code. And I thought this was the point of this discussion, to be able to declare variables when you first use them. -- Rick C. Petty