[Gluster-devel] if/else coding style :-)

Pranith Kumar Karampuri pkarampu at redhat.com
Mon Oct 13 14:08:25 UTC 2014


On 10/13/2014 07:27 PM, Shyam wrote:
> On 10/13/2014 08:01 AM, Pranith Kumar Karampuri wrote:
>> hi,
>>       Why are we moving away from this coding style?:
>> if (x) {
>> /*code*/
>> } else {
>> /* code */
>> }
>
> This patch (in master) introduces the same and explains why,
>
> commit 0a8371bdfdd88e662d09def717cc0b822feb64e8
> Author: Jeff Darcy <jdarcy at redhat.com>
> Date:   Mon Sep 29 17:27:14 2014 -0400
>
>     extras: reverse test for '}' vs. following 'else' placement
>
>     The two-line form "}\nelse {" has been more common than the one-line
>     form "} else {" in our code for years, and IMO for good reason (see
>     the comment in the diff).
Will there be any objections to allow the previous way of writing this 
if/else block? I just don't want to get any errors in 'check-formatting' 
when I write the old way for this.
May be we can change it to warning?

Pranith
>
>     Change-Id: Ic22c76fe76f0d91300daff36e755a18a8db58852
>     Signed-off-by: Jeff Darcy <jdarcy at redhat.com>
>     Reviewed-on: http://review.gluster.org/8888
>     Tested-by: Gluster Build System <jenkins at build.gluster.com>
>     Reviewed-by: Vijay Bellur <vbellur at redhat.com>
>
> Shyam
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at gluster.org
> http://supercolony.gluster.org/mailman/listinfo/gluster-devel



More information about the Gluster-devel mailing list