Re: [PATCH RFC 01/24] ref-filter: get rid of goto

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

 



2018-01-30 23:49 GMT+03:00 Junio C Hamano <gitster@xxxxxxxxx>:
> Оля Тележная  <olyatelezhnaya@xxxxxxxxx> writes:
>
>>> one place improves readability.  If better readability is the
>>> purpose, I would even say
>>>
>>>          for (i = 0; i < used_atom_cnt; i++) {
>>>                 if (...)
>>> -                       goto need_obj;
>>> +                       break;
>>>         }
>>> -       return;
>>> +       if (used_atom_cnt <= i)
>>>                 return;
>>>
>>> -need_obj:
>>>
>>> would make the result easier to follow with a much less impact.
>>
>> It's hard for me to read the code with goto, and as I know, it's not
>> only my problem,...
>
> That sounds as if you are complaining "I wanted to get rid of goto
> and you tell me not to do so???", but read what I showed above again
> and notice that it is also getting rid of "goto".

No, I am not complaining. I tried to explain why I did everything that
way. Sorry if it was not clear enough.

>
> The main difference from your version is that the original function
> is still kept as a single unit of work, instead of two.

And I am not sure that it is good, the function is too big and it
actually does so many different separate pieces. If it is possible to
shorten long function by getting some separate logic (that's our case,
we do not request object until that final goto statement), I think
it's good idea and we need to do so and simplify future reading. But,
if you do not agree with this fact, please explain your position in
detail, and I will change that place as you want.

Thanks.




[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