Date: Sat, 29 Jan 2005 05:36:11 +1100 From: Peter Jeremy <PeterJeremy@optushome.com.au> To: Paul Richards <paul@originative.co.uk> Cc: arch@freebsd.org Subject: Re: c99/c++ localised variable definition Message-ID: <20050128183611.GG32122@cirb503493.alcatel.com.au> In-Reply-To: <20050128173327.GI61409@myrddin.originative.co.uk> References: <20050128173327.GI61409@myrddin.originative.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2005-Jan-28 17:33:27 +0000, Paul Richards wrote: >People used to programming in C++ or Perl (and many others) are used >to defining variables as near to use as possible. This have never been >possible before in C, but now with c99 it is. > >Personally, I find the c++/perl convention to be much less error prone >and more intuitive and since c99 now supports it too it seems the >standards body sees the benefits of this approach as well. It is most useful for variables with a short lexical lifetime in large functions. For a variable with a long lifetime - especially one which is infrequently referenced - it can make it much harder to locate the variable definition. It is also far less obvious what variable are in scope at any point - which is an issue if you are writing some new code and need a work variable. >So, are we going to start allowing this feature to be used in FreeBSD >since it would require a pretty major change to style(9). The biggest problem with making major changes to style(9) is that you wind up with two different styles intermixed in code. This tends to be far less readable than a single style. I would suggest that unless you can demonstrate a major advantage of the new style or intend to sweep the tree to update all existing code to match the new style (and this includes assisting developers with WIP) then you are unlikely to succeed. -- Peter Jeremy
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050128183611.GG32122>