Thread (17 messages) flat view 17 messages, 5 authors, 2016-06-15

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

From: Florian Forster <hidden>
Date: 2016-06-15 22:42:30

On Sun, Jun 18, 2006 at 09:50:37AM -0700, Linus Torvalds wrote:
quoted
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/

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help