Re: coding standards

2018-03-06 Thread don fong
LUE* *}* *else {* *EMIT AN ERROR MESSAGE* *}* the underlying logic is the same as the pre-existing code. all i changed was the *EMIT AN ERROR MESSAGE* part. because it then became an if-statement in its own right, i added the surrounding braces. in many coding standards, the bra

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
rd" is -- an opinion. If one starts a thread with the subject "coding standards", opinions are what one should expect to receive.

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
uot;), name); + else + report_error (_("%s: parameter is not set"), name); +} On Sun, Mar 4, 2018 at 4:43 AM, Clark Wang wrote: > 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 c

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

coding standards

2018-03-03 Thread don fong
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(); else Y(); Form (B): if (flag == 0) Y