Re: [PATCH v5 05/16] bisect--helper: make `terms` an explicit singleton

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Junio,

On Sat, 27 Aug 2022, Junio C Hamano wrote:

> "Johannes Schindelin via GitGitGadget" <gitgitgadget@xxxxxxxxx>
> writes:
>
> > -struct bisect_terms {
> > +static struct bisect_terms {
> >  	char *term_good;
> >  	char *term_bad;
> > -};
> > +} terms;
>
> On the surface, more global state may feel sad, but I do not think
> we want to run multiple bisection in one session anyway.  Overall
> this may result in a simplicity win, hopefully.
>
> The patch is noisy, but mostly from rewriting "terms->member" to
> "terms.member".  I am not sure if that was worth the effort, though.
> You had a code that plumbed a parameter through the call graph, and
> instead of destroying that arrangement, you could have just replaced
> the reference at the beginning of the call chain to use the global
> state instead of an on-stack variable that the caller used to have.
>
> I have no strong preference, but I do not think that it particularly
> contributes to "clarifying that we are using global state" to make
> direct accesses to the variable everywhere.  I dunno.

I do have a strong preference to avoid mixing and matching global
variables with functions that pretend not to use said global variables, as
it is too easy to forget to pass through the corresponding parameter to a
function at a lower layer when that function accesses the global variable
anyway.

Ciao,
Dscho




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux