Date: Tue, 10 Oct 1995 15:01:35 -0400 From: "Garrett A. Wollman" <wollman@lcs.mit.edu> To: Terry Lambert <terry@lambert.org> Cc: wollman@lcs.mit.edu (Garrett A. Wollman), ache@astral.msk.su, Kai.Vorma@hut.fi, current@freebsd.org Subject: Re: tail dumps core Message-ID: <9510101901.AA10410@halloran-eldar.lcs.mit.edu> In-Reply-To: <199510101836.LAA10827@phaeton.artisoft.com> References: <9510101735.AA10192@halloran-eldar.lcs.mit.edu> <199510101836.LAA10827@phaeton.artisoft.com>
next in thread | previous in thread | raw e-mail | index | archive | help
<<On Tue, 10 Oct 1995 11:36:34 -0700 (MST), Terry Lambert <terry@lambert.org> said: >> Neither of these are portable unless the array being cleared is >> composed of characters. There is almost never any reason to use >> calloc(3). > I don't understand where you see a non-portability. Can you please > explain? Thanks. #include <stdio.h> #include <string.h> int main(void) { foo *p; double d; int i; memset(&p, 0, sizeof p); if (p == 0) { printf("an all-bits-zero foo * compares equal to NULL\n"); } else { printf("an all-bits-zero foo * compares different to NULL\n): } memset(&d, 0, sizeof d); if (d == 0) { printf("an all-bits-zero double compares equal to 0\n"); } else { printf("an all-bits-zero double compares different to 0\n"); } memset(&i, 0, sizeof i); if (i == 0) { printf("your machine is normal\n"); } else { printf("your machine is really weird, but allowed by the" " C standard\n"); } return 0; } -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9510101901.AA10410>