git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [GSoC][PATCH v3] apply: Change #define to enum and variable types from int to enum

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 16, 2023, 17:11 UTC
Message-ID
<xmqqttzlr0wm.fsf@gitster.g>
In-Reply-To
<CADE8Nao=ZrF7_0+G=jB8=j5Aji4ndCLfMp-xjbSpc1HKmmFM7w@mail.gmail.com>
Vinayak Dev <vinayakdev.sci@gmail.com> writes:
Show 9 quoted lines
>> As a faithful rewrite, forcing the same values to be given as before
>> by saying that "_DEFLATED must be 1" is a good thing to do, but once
>> the dust settled from the patch, it would be a good idea to go back
>> to the code and see if the values MUST be these, or if it is fine to
>> use any value as long as they are distinct.  If it is the latter,
>> then it would make a good follow-up patch to remove "= 1", with an
>> explanation why it is a safe thing to do.
>
> Removing the 1 _may_ be a safe thing to do, because ...

I didn't mean to suggest you think about it _NOW_ in the context of working on this patch. Rather the opposite. Let's have a faithful rewrite first and then as a follow-on work after this patch becomes part of "git", a further clean-up like that can be a good idea.

Show 9 quoted lines
>> > +enum diff_name {
>> > +     DIFF_OLD_NAME = 0,
>> > +     DIFF_NEW_NAME
>> > +};
>>
>> Ditto.
>
> I think that since enums start with zero by default, you are right in
> saying that the '=0' here can be removed.
Not what I meant.  I was referring to the lack of trailing comma.
> I will do so.
Please don't.
Thanks.
Previous: Vinayak DevNext: Vinayak Dev
Message 4 of 5 in “apply: Change #define to enum and variable types from int to enum”
  1. Vinayak DevFeb 15, 2023
  2. Junio C HamanoFeb 15, 2023
  3. Vinayak DevFeb 16, 2023
  4. Junio C HamanoFeb 16, 2023
  5. Vinayak DevFeb 16, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.