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

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

From
Linus Torvalds <torvalds@osdl.org>
Date
Aug 28, 2005, 17:46 UTC
Message-ID
<Pine.LNX.4.58.0508281045060.3317@g5.osdl.org>
In-Reply-To
<19723.1125249085@lotus.CS.Berkeley.EDU>
On Sun, 28 Aug 2005, Jason Riedy wrote:
Show 6 quoted lines
> 
> 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.

But using "array[]" means that "sizeof()" no longer works, and then you have to use "offsetof()", which is a big pain.

I think all relevant compilers end up accepting [0] (probably giving a warning, especially in some pedantic mode), since it's been how gcc users have been doing things for years (gcc was late to the [] syntax).

			Linus
Previous: Jason RiedyNext: Antti-Juhani Kaijanaho
Message 8 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.