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

Re: [Xen-devel] [PATCH 2/2] CODING_STYLE: Forbid nested block in the hypervisor code



Hi,

On 07/04/2017 03:17 PM, Andrew Cooper wrote:
On 04/07/17 13:20, Jan Beulich wrote:
On 04.07.17 at 14:12, <julien.grall@xxxxxxx> wrote:
When removing if/for/while statements, the code should be reworked to
remove the { } and the extra indentation.
Yes.

This is improving code maintainability and code readability.
For the given example, yes. However, there are (rare) cases where
having such nested blocks actually improves readability, for example
in certain combinations with preprocessor conditionals. Hence I don't
think we should forbid them.

There are also a few specific cases where it is useful to use blocks
like that to introduce a new variable, where introducing it at function
level scope isn't appropriate.  (Alternatively, we could switch from C89
to C99, but that is a separate discussion).

I agree that we should discourage the use of blocks like this, but not
forbid them outright.

Thank you both for the feedback. I will rework the proposal to discourage contributor rather than forbid.

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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