Re: style change: explicitly permit braces for single statements

2020-07-13 Thread Mouse
>> 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

Re: style change: explicitly permit braces for single statements

2020-07-13 Thread Greg A. Woods
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 right margin to be

Re: style change: explicitly permit braces for single statements

2020-07-13 Thread Johnny Billquist
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...   

Re: style change: explicitly permit braces for single statements

2020-07-13 Thread Paul Goyette
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]) {

Re: style change: explicitly permit braces for single statements

2020-07-13 Thread Rhialto
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

Re: style change: explicitly permit braces for single statements

2020-07-13 Thread Mouse
>> 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

Re: style change: explicitly permit braces for single statements

2020-07-13 Thread Joerg Sonnenberger
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

Re: style change: explicitly permit braces for single statements

2020-07-13 Thread Ted Lemon
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

Re: style change: explicitly permit braces for single statements

2020-07-13 Thread Mouse
> 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

re: style change: explicitly permit braces for single statements

2020-07-13 Thread matthew green
> 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: >