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

Re: [PATCH] Fix git to be (more) ANSI C99 compliant.

From
FFFlorian Forster <octo@verplant.org>
Date
Jun 19, 2006, 21:21 UTC
Message-ID
<20060619212116.GL1331@verplant.org>
In-Reply-To
<Pine.LNX.4.64.0606180946090.5498@g5.osdl.org>
On Sun, Jun 18, 2006 at 09:50:37AM -0700, Linus Torvalds wrote:
> > While most of this patch fixes void-pointer arithmetic
> 
> This one I disagree with. Doing arithmetic on "void *" is _really_ useful, 
Agreed: If you want to walk over the memory pointed to by a void-pointer
you want to do that byte-wise in the great majority of all cases.
> and I think most compilers end up supporting it either to be
> compatible with gcc, or just because it's hard to not do it.

Now this statement I don't agree with. (And by that I don't mean I assume it to be false.)

I didn't start writing the patch because I like C99 so much. In fact, in my opinion it introduces some possibilities I'd rather not have in C because people might actually use them. But by default the Sun cc complains about void-pointer arithmetic and I feel awkward to force the compiler to accept broken code.

Maybe Rene Scharfe's method (as used in the patch to git-tar-tree) is a good way around it? There are no explicit casts involved and standard- compliant compilers like it, too. The downside is that you have two variables for the same thing/memory.

Regards, -octo

-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
Previous: Linus TorvaldsNext: Junio C Hamano
Message 11 of 15 in “Fix git to be (more) ANSI C99 compliant.”
  1. Fix git to be (more) ANSI C99 compliant.Florian Forster, Jun 18, 2006
  2. Timo HirvonenJun 18, 2006
  3. Thomas GlanzmannJun 18, 2006
  4. Florian ForsterJun 18, 2006
  5. Timo HirvonenJun 18, 2006
  6. Rene ScharfeJun 18, 2006
  7. Florian ForsterJun 18, 2006
  8. 0/7 Improve ANSI C99 complianceFlorian Forster, Jun 18, 2006
  9. Junio C HamanoJun 18, 2006
  10. Linus TorvaldsJun 18, 2006
  11. Florian ForsterJun 19, 2006
  12. Junio C HamanoJun 20, 2006
  13. Rene ScharfeJun 20, 2006
  14. Junio C HamanoJun 20, 2006
  15. Junio C HamanoJun 21, 2006

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.