Re: coding standards

2018-03-06 Thread don fong
L A Walsh wrote: 1) I see no benefit in the use of extra braces. It diminishes > comprehension in this case. really? to me the braces make the code easier to read, in the context of the surrounding function. they clarify the intention. *if (THE VALUE IS OK) {* *USE THE VALUE* *

Re: coding standards

2018-03-06 Thread L A Walsh
don fong wrote: my patch (form (A)): -report_error (_("%s: parameter null or not set"), name); +{ + if (check_nullness) + report_error (_("%s: parameter null or not set"), name); + else + report_error (_("%s: parameter is not set"), name); +} the new co

Re: coding standards

2018-03-06 Thread Greg Wooledge
On Tue, Mar 06, 2018 at 05:15:36PM +0800, Clark Wang wrote: > I don't know much about bash's source code so I cannot comment much. And > this kind of arguments are quite opinion based which are not simple yes/no > questions. That's precisely what a "coding standard" is -- an opinion. If one start

Re: coding standards

2018-03-06 Thread Clark Wang
I don't know much about bash's source code so I cannot comment much. And this kind of arguments are quite opinion based which are not simple yes/no questions. And I believe one thing - the world is not perfect. :) -clark On Tue, Mar 6, 2018 at 8:26 AM, don fong wrote: > Clark, > > Just took a l

Re: coding standards

2018-03-05 Thread don fong
Clark, Just took a look at the code and it is an int: declaring boolean quantities as int is a common practice in old C code. indeed, all the boolean vars in this program seem to be declared as int. at least, i don't see anything declared as bool. declared type notwithstanding, in the context o

Re: coding standards

2018-03-04 Thread Clark Wang
On Mon, Mar 5, 2018 at 9:13 AM, don fong wrote: > Clark, thanks for your answer. > > I use ``if (flag)'' only when `flag' is a boolean. > > > but in this case, it *is* a boolean, as i stated, and as can be seen in > subst.c: > > +{ > + if (check_nullness) > + report_error (_("%s

Re: coding standards

2018-03-04 Thread don fong
Clark, thanks for your answer. I use ``if (flag)'' only when `flag' is a boolean. but in this case, it *is* a boolean, as i stated, and as can be seen in subst.c: +{ + if (check_nullness) + report_error (_("%s: parameter null or not set"), name); + else + report_

Re: coding standards

2018-03-04 Thread Chet Ramey
On 3/4/18 7:43 AM, Clark Wang wrote: >> i submitted a patch with code in form (A). it was added to the code base >> in form (B). was there a good reason for this mutation? >> > > I believe the main reason is to keep consistent with existing code. That, plus the final change was smaller and sim

Re: coding standards

2018-03-04 Thread Clark Wang
On Sun, Mar 4, 2018 at 5:15 AM, don fong wrote: > admittedly this is a very minor point, but i am curious. this has to do > with coding standards for bash source. > > consider an if statement in C (or bash, for that matter). which is form is > better? > > Form (A): > > if (flag) > X