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