From owner-freebsd-current Tue Oct 10 13:09:54 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id NAA02243 for current-outgoing; Tue, 10 Oct 1995 13:09:54 -0700 Received: from rocky.sri.MT.net (sri.MT.net [204.94.231.129]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id NAA02231 for ; Tue, 10 Oct 1995 13:09:50 -0700 Received: (from nate@localhost) by rocky.sri.MT.net (8.6.12/8.6.12) id OAA22172; Tue, 10 Oct 1995 14:12:01 -0600 Date: Tue, 10 Oct 1995 14:12:01 -0600 From: Nate Williams Message-Id: <199510102012.OAA22172@rocky.sri.MT.net> To: "Garrett A. Wollman" Cc: Nate Williams , current@freebsd.org Subject: Re: tail dumps core In-Reply-To: <9510102001.AA10553@halloran-eldar.lcs.mit.edu> References: <9510101735.AA10192@halloran-eldar.lcs.mit.edu> <199510101836.LAA10827@phaeton.artisoft.com> <9510101901.AA10410@halloran-eldar.lcs.mit.edu> <199510101943.NAA22092@rocky.sri.MT.net> <9510102001.AA10553@halloran-eldar.lcs.mit.edu> Sender: owner-current@freebsd.org Precedence: bulk > > So, what's your point? Other than some comments in this set of lines > > > which implies that memset doesn't have to set an integer to all zeros, > > what's the problem? How does the C standard allow for memseting an int > > to be non-zero? > > The same way it allows for memsetting a pointer to be non-NULL: it > makes no guarantees whatsoever about the underlying bitwise > representation of its data types in memory. You're implying that a 'int i = 0' doesn't assume that the memory location doesn't contain the bytes '0x0000', correct? The prototype of memset() implies that it will indeed set all of the bytes of the underlying data type to the byte value specified in the second arguement. > My point in saying this is not to say that for all practical purposes > you can't depend on this, but rather to say that arguments suggesting > that `calloc' is somehow ``more portable'' are completely specious. I disagree. It is common to assume that sizeof(char) == 8 bits, but this isn't specified anywhere either but most code written would break if this were not true. Using 'calloc()' is much more portable than using bzero(), simply because bzero doesn't exist on many OS's while memset() does. Nate