lmi
[Top][All Lists]
Advanced

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

Re: [lmi] A matter of style


From: Vadim Zeitlin
Subject: Re: [lmi] A matter of style
Date: Mon, 5 Mar 2007 17:27:33 +0100

On Thu, 22 Feb 2007 13:00:10 +0000 Greg Chicares <address@hidden> wrote:

GC> I'm still reluctant to endorse
GC> 
GC>     if(IsVoid())
GC>         return;
GC> 
GC> without any braces, for the reason given in the footnote below.

 For this reason to apply you would presumably have to insert a new line
just before "return" as there is not much sense in adding it below it. And
to be honest I really don't see how can you forget to add braces then. I
can understand how it might happen when you append a line below (you might
not see the top of the if or something like that) but not when you insert a
line in the middle.

GC> This change:
GC> -        return;
GC> +        {return;}
GC> costs only two characters and zero lines. I'll make such changes
GC> in new code now, and in old code as it's revised.

 The line "{return;}" has a rather unique indentation/spacing. As this
change will be done gradually it means that for the foreseeable future such
lines will be rare and so, at least in the beginning, very surprising. And
while I don't normally use aesthetic arguments in technical discussions I
can't hide that personally I think this look very ugly. And in any case it
definitely looks unusual and so attracts attention to this line which is
undesirable as this line is not important at all: the precondition check is
not very important on its own (less important than the actual function
body, that is) and this line is even less so.

 So IMHO using just the usual "return" would be better.

 Regards,
VZ





reply via email to

[Prev in Thread] Current Thread [Next in Thread]