Re: [PATCH] CodingGuidelines: mention "static" and "extern"
- Date: Fri, 9 Feb 2018 14:33:19 -0500
- From: Jeff King <peff@xxxxxxxx>
- Subject: Re: [PATCH] CodingGuidelines: mention "static" and "extern"
On Fri, Feb 09, 2018 at 11:07:38AM -0800, Jonathan Tan wrote:
> On Thu, 8 Feb 2018 18:14:06 -0500
> Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote:
> > On Thu, Feb 8, 2018 at 4:38 PM, Jeff King <peff@xxxxxxxx> wrote:
> > > Subject: [PATCH] CodingGuidelines: mention "static" and "extern"
> > > [...]
> > >
> > > Signed-off-by: Jeff King <peff@xxxxxxxx>
> > > ---
> > > diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> > > @@ -386,6 +386,11 @@ For C programs:
> > > + - Variables and functions local to a given source file should be marked
> > > + with "static". Variables that are visible to other source files
> > > + must be declared with "extern" in header files. However, function
> > > + declarations should not use "extern", as that is already the default.
> > Perhaps:
> > ... as that is already the default, unless declarations in the
> > header are already "extern", in which case consistency
> > may favor mirroring existing usage.
> > or something.
> I would prefer not mirroring existing usage in this case - I think it's
> better if the code becomes eventually consistent in not using extern.
Agreed. I think individual bullets in CodingGuidelines should be
definitive where possible, describing the end-game we strive for.