Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!mips!apple!netcom!sjsumcs!horstman From: horstman@mathcs.sjsu.edu (Cay Horstmann) Newsgroups: comp.lang.c++ Subject: Re: Why no renew Message-ID: <1991Mar14.042611.14921@mathcs.sjsu.edu> Date: 14 Mar 91 04:26:11 GMT References: <10895@pasteur.Berkeley.EDU> <1991Mar3.053504.14027@mathcs.sjsu.edu> <281@nazgul.UUCP> Organization: San Jose State University - Math/CS Dept. Lines: 21 In article <281@nazgul.UUCP> bright@nazgul.UUCP (Walter Bright) writes: >In article <1991Mar3.053504.14027@mathcs.sjsu.edu> horstman@mathcs.sjsu.edu (Cay Horstmann) writes: >/SINCE I AM AT IT: It would be awful nice if operator new could zero out >/the memory when allocating arrays of integers or pointers (i.e. fill the >/array with the bit pattern corresponding to a logical zero.) > >Ah, but you can do it! Simply overload the global operator new to use >calloc. It's even portable! I cannot call such a solution portable. If my code relies on the global operator new doing one thing and your code relies on the global operator new doing something different, we cannot share code for the same program. (The ARM [p.60] has a similar comment.) I repeat my request that operator new should default to initializing the memory with the logical 0 value for the type allocated (almost always an all-0 bit pattern, but then who knows how 0 pointers or 0.0 floats are represented on some crazy systems.) ANSI, are you listening? Cay