Re: [PATCH v2 01/13] packfile.h: drop extern from function declarations
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 8, 2019, 05:13 UTC
- Message-ID
- <xmqqzhp19j0y.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190405192534.GA4496@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> On Fri, Apr 05, 2019 at 08:19:30PM +0100, Ramsay Jones wrote: > >> > /* global flag to enable extra checks when accessing packed objects */ >> > -extern int do_check_packed_object_crc; >> > +int do_check_packed_object_crc; >> >> ... removing this 'extern' on an int variable sends 'sparse' >> into a frenzy of warnings! :-D >> >> [You didn't use a global s/extern// by any chance?] > > Oh my. I did look at each one, but probably via replace-and-confirm in > vim. I don't know how I managed to botch that one so badly.
Perhaps we should keep 'extern' even when declaring (not defining) a public function in the header file to avoid a gotcha like this?
What was the reasoning behind the insn in CodingGuidelines? "As it is already the default" does qualify as a reasonable justification for telling "extern is not needed for functions" to our readers, but not quite enough for "extern should not be used for functions".