[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: Marc Singer <elf_at_buici.com>
Date: 2003-10-14 04:45:42 CEST

On Mon, Oct 13, 2003 at 10:21:52PM -0400, Daniel Berlin wrote:
>
> On Oct 13, 2003, at 9:54 PM, Marc Singer wrote:
>
> >On Mon, Oct 13, 2003 at 06:11:08PM -0700, Jack Repenning wrote:
> >>>Sooooo, a simple way of being sure that your memory is initialized
> >>>properly, even on systems where a null pointer constant is not
> >>>all-zero-bits, is this:
> >>>
> >>> struct some_complex_struct *foo
> >>>
> >>> {
> >>> struct some_complex_struct __tmp = { 0 };
> >>
> >>Doesn't this fail for the case where the _first_ field of
> >>some_complex_struct is a pointer, and the local architecture does
> >>something inane with NULL?
> >
> >Is there an architecture that doesn't use ((void*) 0) for NULL?
>
>
> That would violate the C99 standard.

I have to assume you mean the (void *) part which isn't the point. Is
there an architecture that does use 0 for NULL? While the standard
allows for other values, I've never seen one nor have I ever heard of
anyone says that the wacky Bignitz10K had a different way of
representing null pointers.

Here's what GNUC does in /usr/include/libio.h

#ifndef NULL
# if defined __GNUG__ && \
    (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
# define NULL (__null)
# else
# if !defined(__cplusplus)
# define NULL ((void*)0)
# else
# define NULL (0)
# endif
# endif
#endif

Is there any reason to think that BSS initialization is insufficient?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 14 04:46:22 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.