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

Re: [RFC] CodingGuidelines: mark external declarations with "extern"

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 9, 2020, 23:05 UTC
Message-ID
<xmqqblhbrodw.fsf@gitster.c.googlers.com>
In-Reply-To
<20201009230033.GA31120@generichostname>
Denton Liu <liu.denton@gmail.com> writes:
Show 16 quoted lines
>> And I have a strong preference, after thinking about it, to have
>> "extern" in front in the declarations.  It gives another clue for
>> patterns I feed to "git grep" to latch onto, and help my eyes to
>> scan and tell decls and defns apart in the output.  The benefit
>> alone is worth the extra 7 columns in front spent, which you call
>> "clutter".
>
> To be honest, I do not have any preference between having the explicit
> extern or not. I do have a strong preference, however, for having a
> codebase that's consistently written. When I was doing the refactor, I
> wouldn't have minded introducing extern everywhere although that wasn't
> suggested as an alternative.
>
> I agree that these are all benefits of declaring functions explicitly as
> extern. However, I don't think they're worth the cost of either another
> huge rewrite or an inconsistent codebase.

Yes, there is a cost associated with having made a mistake in the past. Biting the bullet now, perhaps as the first tree-wide change immediately after the upcoming release, while the tree is quiescent, would help us in the longer term, than having to live without extern on declarations.

Previous: Denton LiuNext: Đoàn Trần Công Danh
Message 9 of 15 in “clean up extern decl of functions”
  1. clean up extern decl of functionsJunio C Hamano, Oct 8, 2020
  2. Denton LiuOct 9, 2020
  3. Junio C HamanoOct 9, 2020
  4. Junio C HamanoOct 9, 2020
  5. [RFC] CodingGuidelines: mark external declarations with "extern"Junio C Hamano, Oct 9, 2020
  6. Jeff KingOct 9, 2020
  7. Junio C HamanoOct 9, 2020
  8. Denton LiuOct 9, 2020
  9. Junio C HamanoOct 9, 2020
  10. Đoàn Trần Công DanhOct 10, 2020
  11. Jeff KingOct 15, 2020
  12. Junio C HamanoOct 15, 2020
  13. Jeff KingOct 15, 2020
  14. 1/2 usage: define a type for a reporting functionJeff King, Oct 15, 2020
  15. 2/2 config.mak.dev: build with -fno-commonJeff King, Oct 15, 2020

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.