[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [lmi-commits] master 2afd2fe 3/6: Improve concinnity
From: |
Greg Chicares |
Subject: |
Re: [lmi] [lmi-commits] master 2afd2fe 3/6: Improve concinnity |
Date: |
Fri, 3 Mar 2017 15:30:55 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 |
On 2017-03-03 14:29, Vadim Zeitlin wrote:
> On Tue, 28 Feb 2017 22:02:58 -0500 (EST) Greg Chicares <address@hidden> wrote:
>
> GC> branch: master
> GC> commit 2afd2fe24692899ca0f06094707896bbdc3e3e80
[...]
> GC> case e_maturity:
> GC> {
> GC> LMI_ASSERT(i == rows_count_ - 1);
> GC> // " maturity" is implicit, don't add it
> GC> - break;
> GC> }
> GC> -
> GC> + break;
>
> Just to be sure, is always using braces around the "case" statements, even
> when they're not necessary, also a convention in lmi? I am going to update
> my mental lmi style guide with this one as I didn't really notice this
> before (and maybe some day I'll translate this guide from the mental to
> written form, with your help...).
This is all discussed here...
file:///home/greg/gwc/style.html
but I guess you don't have /home/greg/ so you can't read it. I could send
you a copy by personal email if you like. I can't publish it as it stands
because it quotes some copyrighted material. There's another reason why I
shouldn't publish it now: it's outdated. For example, it mandates a
'default:' case that triggers a run-time error, but these days it's better
to specify a 'case' for every enumerator and let the compiler give a
compile-time error if any enumerator was omitted.
Anyway, point 16.10 in that document says: "Surround all case blocks with
{} so that local variables can be declared inside. Even if you don't do
that today, tomorrow someone else will." That's a mistake to which I am
still prone (even if you are not), and writing {} everywhere is cheap
insurance for me--with 'case' as with 'if'.