Re: [PATCH 1/7] Rework strbuf API and semantics.
- From
David Kastrup <dak@gnu.org>
- Date
- Sep 6, 2007, 15:53 UTC
- Message-ID
- <85hcm7bxjl.fsf@lola.goethe.zz>
- In-Reply-To
- <20070906153613.GA4008@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 19 quoted lines
> On Thu, Sep 06, 2007 at 05:06:52PM +0200, David Kastrup wrote: > >> > If an object that has automatic storage duration is not initialized >> > explicitly, its value is indeterminate. If an object that has static >> > storage duration is not initialized explicitly, then: >> > >> > -- if it has pointer type, it is initialized to a null pointer; >> >> That's actually a new one to me. I don't think that it has been >> always the case in ANSI C. > > I don't have the C89 standard, so it's hard to be authoritative. > However, according to TCOR1 to the C89 standard, the original text of > 6.5.7 contained: > > If an object that has static storage duration is not initialized > explicitly, it is initialized implicitly as if every member that has > arithmetic type were assigned 0 and every member that has pointer type > were assigned a null pointer constant.
Maybe I am confusing this with the effects of calloc or memset(...,0).
> But for the case of pointer initializations, both have the same > effect. So I think it has always been the case. Pre-ANSI, who > knows. :)
In the original K&R C, a null pointer likely could have been assumed to have zero bits throughout. The non-zero-bits NULL pointer concept just reeks of standard committees... So maybe this never had been an issue, for different reasons.
> And now I must go get some real work done instead of snooping > through standards. :)
Sorry for the diversion.
-- David Kastrup, Kriemhildstr. 15, 44793 Bochum