Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
- From
- Florian 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/