Path: utzoo!attcan!uunet!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Representation of NULL and 0.0 (was Re: Zero Length Arrays ...) Message-ID: <15468@haddock.ima.isc.com> Date: 18 Dec 89 19:35:54 GMT References: <545@mwtech.UUCP> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 25 In article <545@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes: >Wouldn't it have been wise to add another 'calloc' for floating >types and NULL pointers, as the initializing feature of calloc >is weak in this respect? You still wouldn't have a way to allocate a zeroed struct of mixed types. Personally, I think a wiser move would be to get rid of calloc(), since its initializing feature is largely useless and misleading (and since its other "feature", namely multiplying the two arguments together, can be done just as easily and probably more efficiently at the caller's end). I suspect that the Commitee generally agrees, but was forced to keep calloc() for historical reasons. >Now, how is the situation with statically allocated data...? The pANS requires that a static-duration datum not covered by an explicit initializer (or an automatic-duration datum which is part of an initialized aggregate but beyond the end of the explicit initializer, K&R2 to the contrary notwithstanding) must have an initial value of a properly-typed zero. Thus, a non-VAXlike implementation cannot simply put all uninitialized objects into a "bss segment". (But it could sort them by type and have an "all-bits-zero segment", a "floating-point zero space", etc. if it's worth the effort.) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint