From owner-freebsd-current Tue Oct 10 13:01:59 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id NAA02060 for current-outgoing; Tue, 10 Oct 1995 13:01:59 -0700 Received: from halloran-eldar.lcs.mit.edu (halloran-eldar.lcs.mit.edu [18.26.0.159]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id NAA02045 for ; Tue, 10 Oct 1995 13:01:55 -0700 Received: by halloran-eldar.lcs.mit.edu; (5.65/1.1.8.2/19Aug95-0530PM) id AA10553; Tue, 10 Oct 1995 16:01:46 -0400 Date: Tue, 10 Oct 1995 16:01:46 -0400 From: "Garrett A. Wollman" Message-Id: <9510102001.AA10553@halloran-eldar.lcs.mit.edu> To: Nate Williams Cc: current@freebsd.org Subject: Re: tail dumps core In-Reply-To: <199510101943.NAA22092@rocky.sri.MT.net> 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> Sender: owner-current@freebsd.org Precedence: bulk < said: > 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. > Also, you made the assertion that calloc() is almost never necessary. I > charge you to backup that statement, since I often use structures which > I must explicity zero out all of the members, and using calloc() and/or > malloc/memset is a big performance win compared to zero'ing out every > single member of the struct. Explicitly zeroing out every single member of a structure is the ONLY way the C Standard provides to set each member to an appropriate zero value for its type, except in the limited situation where every element of the array is of type `char' or `char []'. 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. -GAWollman -- Garrett A. Wollman | Shashish is simple, it's discreet, it's brief. ... wollman@lcs.mit.edu | Shashish is the bonding of hearts in spite of distance. Opinions not those of| It is a bond more powerful than absence. We like people MIT, LCS, ANA, or NSA| who like Shashish. - Claude McKenzie + Florent Vollant