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

Re: [PATCH] Spell __attribute__ correctly in cache.h.

From
Jason Riedy <ejr@eecs.berkeley.edu>
Date
Aug 28, 2005, 17:11 UTC
Message-ID
<19723.1125249085@lotus.CS.Berkeley.EDU>
In-Reply-To
<7vll2mmkqk.fsf@assigned-by-dhcp.cox.net>
And Junio C Hamano writes:
 - >  +    Replace C99 array initializers with code.
 - I presume this is to help older compilers?

Yes, so it's relatively unimportant. I could work around it in my situation; I only included it because it's "necessary" for some Sun compilers on older Solaris installations. A static gcc build works well enough in my situation.

 - >  +    Replace unsetenv() and setenv() with older putenv().
 - I wonder how buggy various implementations of
 - putenv("THIS_ENV_VAR") are to remove the variable.

I don't know, and it doesn't seem to matter in the git code. I didn't see checks for existance, but I may have missed something. Most uses replace a NULL with a pointer to "", which is why I just used putenv("FOO=").

This is to cope with an older Solaris installation I have to use. ugh. I can use a better compiler, but I'm stuck with the system library. Other older systems probably don't have unsetenv(), either.

The "right" way would be to twiddle the environ and use execle, but that's nasty.

 - >  +    Replace zero-length array decls with [].
 - This I am ambivalent about.

I'm fine with requiring a limited C99 compiler. A pedantic compiler will reject members with a length of zero. 6.7.5.2 para1 requires a value greater than zero for a constant array size. So the code now (with [0] decls) is neither C89 nor C99.

Jason
Previous: Junio C HamanoNext: Linus Torvalds
Message 7 of 13 in “Spell __attribute__ correctly in cache.h.”
  1. Spell __attribute__ correctly in cache.h.Jason Riedy, Aug 19, 2005
  2. Junio C HamanoAug 19, 2005
  3. Jason RiedyAug 19, 2005
  4. Junio C HamanoAug 19, 2005
  5. Jason RiedyAug 23, 2005
  6. Junio C HamanoAug 28, 2005
  7. Jason RiedyAug 28, 2005
  8. Linus TorvaldsAug 28, 2005
  9. Antti-Juhani KaijanahoAug 28, 2005
  10. Linus TorvaldsAug 28, 2005
  11. Martijn KuipersAug 29, 2005
  12. Antti-Juhani KaijanahoAug 29, 2005
  13. Martijn KuipersAug 29, 2005

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.