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

Re: [PATCH] add status.relativePaths config variable

From
Jeff King <peff@peff.net>
Date
Dec 8, 2007, 08:45 UTC
Message-ID
<20071208084552.GA5206@coredump.intra.peff.net>
In-Reply-To
<7v63z9y5k2.fsf@gitster.siamese.dyndns.org>
On Sat, Dec 08, 2007 at 12:05:49AM -0800, Junio C Hamano wrote:
Show 16 quoted lines
> >> index 225fb4d..63d50f2 100644
> >> --- a/wt-status.h
> >> +++ b/wt-status.h
> >> @@ -28,6 +28,7 @@ struct wt_status {
> >>  
> >>  int git_status_config(const char *var, const char *value);
> >>  int wt_status_use_color;
> >> +int wt_status_relative_paths;
> >>  void wt_status_prepare(struct wt_status *s);
> >>  void wt_status_print(struct wt_status *s);
> >
> > Shouldn't both of these ints be marked "extern"? I'm surprised it worked
> > at all (or perhaps the part of my brain that stores C linkage issues is
> > rotting?).
> 
> Yes, rotting very much.

Nope, there's still a little grey matter left. It is not technically guaranteed by the standard to work, since the declaration in every source file which includes wt-status.h is a "tentative definition." Fortunately, the linker is nice enough to figure out what's going on as long as only one is actually initialized. This is listed in C99 Section J.5.11 as a "Common extension".

The Summit C FAQ mentions it as well:
  http://c-faq.com/decl/decldef.html

So "extern" is better, but apparently not required for any linkers we care about. Note that omitting "extern" _is_ illegal in C++, but fortunately we _really_ don't care about those linkers. :)

But at least I'm not totally crazy.
-Peff
Previous: Junio C HamanoNext: Jeff King
Message 10 of 12 in “quote_path: convert empty path to "./"”
  1. quote_path: convert empty path to "./"Jeff King, Dec 7, 2007
  2. Johannes SchindelinDec 7, 2007
  3. Thomas HarningDec 7, 2007
  4. Jeff KingDec 7, 2007
  5. add status.relativePaths config variableJeff King, Dec 7, 2007
  6. Junio C HamanoDec 8, 2007
  7. Junio C HamanoDec 8, 2007
  8. Jeff KingDec 8, 2007
  9. Junio C HamanoDec 8, 2007
  10. Jeff KingDec 8, 2007
  11. Jeff KingDec 8, 2007
  12. Junio C HamanoDec 8, 2007

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.