On Jul 12, 2020, at 9:31 PM, Greg A. Woods wrote:
>
> Personally I don't think there's any good excuse for not always putting
> braces around all single-statement blocks. The only bad execuse is that
> the language doesn't strictly require them. People are lazy, I get that
> (I am too), but in
I've decided not to pursue this any further.
No objections if anyone else wants to take up the cause.
On 20-07-17 23:20, Alistair Crooks wrote:
| Just to get back to the original subject - fully support {} around single
| statements - have been doing that in my own code for ages.
|
|
Just to get back to the original subject - fully support {} around single
statements - have been doing that in my own code for ages.
Would be great to have that codified (ha!)
On Thu, 16 Jul 2020 at 12:01, Rhialto wrote:
> On Thu 16 Jul 2020 at 13:08:49 -0400, Ted Lemon wrote:
> > It sounds
On Jul 16, 2020, at 12:16 PM, Gerhard Sittig wrote:
> Text line length does matter to those of us who put several
> copies of code side by side.
It sounds like we need a better tool. FWIW, when actually working on code,
I’ve found that 120 is a better width than 80—with 80, there are just too
On Mon, 2020-07-13 at 09:18 -0700, Greg A. Woods wrote:
>
> At Mon, 13 Jul 2020 09:48:07 -0400 (EDT), Mouse
> wrote:
> Subject: Re: style change: explicitly permit braces for single statements
> >
> > Slavishly always
> > adding them makes it difficult to keep co
On Thu 16 Jul 2020 at 13:08:49 -0400, Ted Lemon wrote:
> It sounds like we need a better tool. FWIW, when actually working on
> code, I've found that 120 is a better width than 80 -- with 80, there are
> just too many line breaks. But I don't mean to say that your
> preference is wrong -- what
> E.g. web browsers just reflow the text when you change the window
> width. Why don=E2=80=99t we have this for code editors?
Short answer: try to build it and you'll see.
Longer answer: Because the exact layout of `words' affects readability
of code far more than it does running text.
>> if (ch == t.c_cc[VINTR]) {
>> } else {
>> if (ch == t.c_cc[VQUIT]) {
>> } else {
>> if (ch == t.c_cc[VKILL]) {
>> } else {
>> }
>> }
>> }
> For this, I would prefer
> if
At Mon, 13 Jul 2020 09:48:07 -0400 (EDT), Mouse
wrote:
Subject: Re: style change: explicitly permit braces for single statements
>
> Slavishly always
> adding them makes it difficult to keep code from walking into the right
> margin:
These days one really should consider the
On 2020-07-13 17:52, Paul Goyette wrote:
if (ch == t.c_cc[VINTR]) {
...do INTR processing...
} else {
if (ch == t.c_cc[VQUIT]) {
...do QUIT processing...
} else {
if (ch == t.c_cc[VKILL]) {
...do KILL processing...
if (ch == t.c_cc[VINTR]) {
...do INTR processing...
} else {
if (ch == t.c_cc[VQUIT]) {
...do QUIT processing...
} else {
if (ch == t.c_cc[VKILL]) {
On Mon 13 Jul 2020 at 09:48:07 -0400, Mouse wrote:
> I'd actually recommend one exception, that being the else-if chain: if
> the dependent clause after an else is a single statement, and it is an
> if statement, then, depending on the semantic relationship of the inner
> if's test to the
>> I find the braces pure visual clutter in the latter.
> What really bugs me is when my code winds up with a security fail because I $
Yeah, that bugs me too.
But "don't be careless" isn't something codifiable enough to go on a
list of style rules such as this one.
> â??Because it looks
On Mon, Jul 13, 2020 at 09:18:18AM -0400, Ted Lemon wrote:
> On Jul 13, 2020, at 9:13 AM, Mouse wrote:
> > . I find the braces pure visual clutter in the latter.
>
> What really bugs me is when my code winds up with a security fail because I
> wasn’t careful.
If only we had compilers that
On Jul 13, 2020, at 9:13 AM, Mouse wrote:
> . I find the braces pure visual clutter in the latter.
What really bugs me is when my code winds up with a security fail because I
wasn’t careful. I’ve had this happen maybe three or four times in my career,
which isn’t too bad, but it’s hard to
> Personally I don't think there's any good excuse for not always
> putting braces around all single-statement blocks.
Well, you may not think it good, but I prefer
if (x < 0) return(n);
to
if (x < 0) { return(n); }
. I find the braces pure visual clutter in the latter.
I
> On 20-07-12 10:01, Luke Mewburn wrote:
> | I propose that the NetBSD C style guide in to /usr/share/misc/style
> | is reworded to more explicitly permit braces around single statements,
> | instead of the current discourgement.
> |
> | IMHO, permitting braces to be consistently used:
>
At Sun, 12 Jul 2020 10:01:36 +1000, Luke Mewburn wrote:
Subject: style change: explicitly permit braces for single statements
>
> I propose that the NetBSD C style guide in to /usr/share/misc/style
> is reworded to more explicitly permit braces around single statements,
> instead of
A few years ago when I worked at Tesla, we had to have our production code
pass a MISRA C linter: https://gimpel.com/
MISRA C requires braces even with a single clause. I'm not going to try to
justify MISRA C's rules; but only say that 'programmers in automobile /
embedded' world probably find
Date:Sun, 12 Jul 2020 13:01:59 +1000
From:Luke Mewburn
Message-ID: <20200712030159.gh12...@mewburn.net>
| | IMHO, permitting braces to be consistently used:
| | - Adds to clarity of intent.
| | - Aids code review.
| | - Avoids gotofail:
On 12/07/2020 04:01, Luke Mewburn wrote:
On 20-07-12 10:01, Luke Mewburn wrote:
| I propose that the NetBSD C style guide in to /usr/share/misc/style
| is reworded to more explicitly permit braces around single statements,
| instead of the current discourgement.
|
| IMHO,
p...@whooppee.com (Paul Goyette) writes:
>Another +1 here. The "add another statement" is frequently "add a
>debug_printf()" and many is the time i've broken an if statement by
>adding debug code.
{ debug_printf();
}
works and doesn't get forgotten before committing.
I personally find
On 20-07-12 10:01, Luke Mewburn wrote:
| I propose that the NetBSD C style guide in to /usr/share/misc/style
| is reworded to more explicitly permit braces around single statements,
| instead of the current discourgement.
|
| IMHO, permitting braces to be consistently used:
| - Adds
On Sun, 12 Jul 2020, Valery Ushakov wrote:
Luke Mewburn wrote:
I propose that the NetBSD C style guide in to /usr/share/misc/style
is reworded to more explicitly permit braces around single statements,
instead of the current discourgement.
IMHO, permitting braces to be consistently used:
-
Luke Mewburn wrote:
> I propose that the NetBSD C style guide in to /usr/share/misc/style
> is reworded to more explicitly permit braces around single statements,
> instead of the current discourgement.
>
> IMHO, permitting braces to be consistently used:
> - Adds to clarity of intent.
> - Aids
On Sun, Jul 12, 2020 at 10:01:36AM +1000, Luke Mewburn wrote:
> I propose that the NetBSD C style guide in to /usr/share/misc/style
> is reworded to more explicitly permit braces around single statements,
> instead of the current discourgement.
concur
Really, there should always be braces
I propose that the NetBSD C style guide in to /usr/share/misc/style
is reworded to more explicitly permit braces around single statements,
instead of the current discourgement.
IMHO, permitting braces to be consistently used:
- Adds to clarity of intent.
- Aids code review.
- Avoids gotofail:
27 matches
Mail list logo