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

Re: [PATCH v2] Make fetch-pack a builtin with an internal API

From
APAndy Parkins <andyparkins@gmail.com>
Date
Jul 9, 2007, 15:28 UTC
Message-ID
<200707091628.14377.andyparkins@gmail.com>
In-Reply-To
<20070709144030.GE16032@thunk.org>
On Monday 2007 July 09, Theodore Tso wrote:
> > "All identifiers beginning with an underscore are reserved for ordinary
> > identifiers (functions, variables, typedefs, enumeration constants) with
> > file
> > scope."
> I think the above does agree with what I said.  It says that you can
> use functions, variables, typdefs, enumeration constants (not just
> labels or structure members) WITH FILE SCOPE.  I.e., so long as it
> doesn't leak across a .o linkage.  So one .o file can use a static

I'm reading it as meaning they are reserved at file scope; not that you can use them at file scope.

> _my_strdup, and another .o file can use a static _my_strdup, and they
> don't have to worry about multiply defined function conflicts, since
> they are static functions with file or smaller scoping.

Erm, but we're not talking about your own .o files we're talking about conflicting with the library; what you say would be true for any identifier. We have no way of guaranteeing that _my_strdup() isn't defined by one of the standard library headers that have been included. The standard header is entitled to use underscore identifiers because they have been reserved at file scope.

Reading a little further into the FAQ you posted, I found the following in the list of exceptions:

"You may use identifiers consisting of an underscore followed by a digit or lower case letter for labels and structure/union members." and "You may use identifiers consisting of an underscore followed by a digit or lower case letter at function, block, or prototype scope."

I'm more sure now - you can't use underscore identifiers at file scope.

Regardless, we're just splitting hairs now. We seem to both agree that it's easiest just to outright not use underscore-prefixed identifiers; so I'm happy. :-)

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
Previous: Florian Weimer
Message 10 of 10 in “Make fetch-pack a builtin with an internal API”
  1. Make fetch-pack a builtin with an internal APIDaniel Barkalow, Jul 9, 2007
  2. Junio C HamanoJul 9, 2007
  3. Daniel BarkalowJul 9, 2007
  4. René ScharfeJul 9, 2007
  5. Daniel BarkalowJul 9, 2007
  6. Theodore TsoJul 9, 2007
  7. Andy ParkinsJul 9, 2007
  8. Theodore TsoJul 9, 2007
  9. Florian WeimerJul 9, 2007
  10. Andy ParkinsJul 9, 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.