[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: NULL pointers.

From: Greg Hudson <ghudson_at_MIT.EDU>
Date: 2003-10-14 07:23:03 CEST

On Tue, 2003-10-14 at 01:14, Marc Singer wrote:
> On Mon, Oct 13, 2003 at 11:10:12PM -0400, Daniel Berlin wrote:
> > "An integer constant expression with the value 0, or such an expression
> > cast to type void *, iscalled anull pointer constant.
> Again, this isn't the point. Yes, you are well acquainted with the C
> standard. Nice work.

That comes off as sarcastic (to me, anyway); please try to maintain a
higher level of civility on this list, even when people miss the point.

> However, I'm not talking about the C standard.
> I'm talking about the machine representations.
> AFAIK, there are no representations of null that are not zero.

http://www.eskimo.com/~scs/C-faq/q5.17.html describes some, but the
answer is pretty much "you'll never run into one in practice."

To sum up, in case anyone's still confused:

  BSS initialization works because of the standard
  Initializers of zero work because of the standard
  Wherever you see NULL, you can write 0; it will make no difference
   for correctness, though it's usually less clear
  bzero/calloc works in practice because the machine representation
   is always all-bits-zero in practice, but the standard does not
   guarantee that
  C89 and C99 do not differ on any of these points

(As a side point, in a varargs list, neither 0 nor NULL are technically
correct unless casted. So if you're calling execl(), you should cast
the argument-ending NULL if you're concerned with the fine points of the

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 14 07:24:04 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.