[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC v2 06/13] libxl: permit declaration after statement



Ian Campbell writes ("Re: [Xen-devel] [PATCH RFC v2 06/13] libxl: permit 
declaration after      statement"):
> Variable declarations should either be at the top of the function or
> immediately before / as part of the block which uses them. e.g. this is
> unhelpful:

I agree..

> void a_func(void)
> {
>       /* a bunch of code; */
> 
>       int bar;
> 
>       /* a bunch more code not using bar */
> 
>       bar = get_me_a_bar();
> 
>       /* use bar lots */
> }

Yes, but would anyone really write that ?  I think the argument is
about this:

        /* a bunch of code; */
 
        int bar = get_me_a_bar();
 
        /* use bar lots */

I think this is fine and I think Stefano objects.

How about:

  Declarations of automatic variables should either be at the start of
  the relevant function (or block), or as late as reasonable; in the
  latter case they should be initialised in the declaration if
  possible.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.