All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timo Hirvonen <tihirvon@gmail.com>
To: git@vger.kernel.org
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Use explicit pointers for execl...() sentinels.
Date: Sun, 12 Mar 2006 20:08:12 +0200	[thread overview]
Message-ID: <20060312200812.3fb04638.tihirvon@gmail.com> (raw)
In-Reply-To: <slrne18mq3.fr9.mdw@metalzone.distorted.org.uk>

On Sun, 12 Mar 2006 17:32:51 +0000 (UTC)
Mark Wooding <mdw@distorted.org.uk> wrote:

> Besides, (void *)0 fixes /this particular/ problem, because `void *' and
> `char *' have the same representation (6.2.5#27).  This wouldn't help us
> with a putative function which takes an arbitrary number of `foo *'
> pointers, since nothing guarantees that `void *' and `foo *' have
> similar representations.  You'd have to say `(foo *)0' or `(foo *)NULL'.

NULL pointer does not point to any data, it just says it's 'empty'.  So
it doesn't need to be same type pointer as specified in the function
prototype.  Pointers are just addresses, it doesn't matter from to code
generation point of view whether it is (char *)0 or (void *)0.

> Don't know: didn't look.  0L won't do the right thing with IL32LLP64, if
> anyone was actually crazy enough to specify such an ABI.  The point is,
> there's not much 

sizeof(unsigned long) is sizeof(void *) in real world.

> > How about fixing those systems instead of making the git source code
> > unreadable.
> 
> Because, according to the C and POSIX specs, they're not wrong.

They didn't think of 64-bit architectures back then, I suppose.

> The right fix from the point of view of a C implementation would be to
> define NULL to be some weird __null_pointer token which the compiler
> could warn about whenever it was used in an untyped argument context.

In practice (void *)0 is good enough.

> (Besides, I don't find bare or casted `0' unreadable.  Maybe I'm just
> strange.)

'ugly' would have been better word than 'unreadable'.

-- 
http://onion.dynserv.net/~timo/

  reply	other threads:[~2006-03-12 18:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-11 19:29 [PATCH] Trivial warning fix for imap-send.c Art Haas
2006-03-12 10:44 ` Mark Wooding
2006-03-12 11:27   ` Junio C Hamano
2006-03-12 13:59     ` [PATCH] Use explicit pointers for execl...() sentinels Mark Wooding
2006-03-12 15:13       ` Timo Hirvonen
2006-03-12 17:32         ` Mark Wooding
2006-03-12 18:08           ` Timo Hirvonen [this message]
2006-03-13  3:31             ` Jeff King
2006-03-13  4:12               ` Horst von Brand
2006-03-14  0:42                 ` [OT] " Jeff King
2006-03-12 16:57   ` [PATCH] Trivial warning fix for imap-send.c Linus Torvalds
2006-03-12 18:01     ` Mark Wooding
2006-03-12 19:20       ` A Large Angry SCM
2006-03-13  2:59         ` H. Peter Anvin
2006-03-13  4:36           ` A Large Angry SCM
2006-03-13  5:22             ` Linus Torvalds
2006-03-13  6:37               ` H. Peter Anvin
2006-03-13  6:46                 ` Linus Torvalds
2006-03-13 16:37                 ` Olivier Galibert
2006-03-13  3:38         ` Jeff King
2006-03-13  4:14           ` Horst von Brand
2006-03-13 16:26             ` Linus Torvalds
2006-03-13  6:41           ` H. Peter Anvin
2006-03-12 21:51       ` Horst von Brand
2006-03-12 23:02       ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060312200812.3fb04638.tihirvon@gmail.com \
    --to=tihirvon@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.