Date: Thu, 30 Apr 2009 18:37:27 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: rick-freebsd2008@kiwi-computer.com Cc: freebsd-hackers@FreeBSD.org Subject: Re: C99: Suggestions for style(9) Message-ID: <20090430.183727.803597558.imp@bsdimp.com> In-Reply-To: <20090430233648.GA95360@keira.kiwi-computer.com> References: <20090428114754.GB89235@server.vk2pj.dyndns.org> <20090430.090226.1569754707.imp@bsdimp.com> <20090430233648.GA95360@keira.kiwi-computer.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20090430233648.GA95360@keira.kiwi-computer.com> "Rick C. Petty" <rick-freebsd2008@kiwi-computer.com> writes: : 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. Hmmm, looks like that was added. That's ugly as C++... : And I thought this was the point of this discussion, to be able to declare : variables when you first use them. That's one of the proposed changes, which I think is a mistake and would cause the most code churn. And it isn't one of the items that's being discussed: only moving variables into inner scopes is on the table... Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090430.183727.803597558.imp>