Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!pasteur!galileo.berkeley.edu!jbuck From: jbuck@galileo.berkeley.edu (Joe Buck) Newsgroups: comp.lang.c++ Subject: Re: Why no renew Message-ID: <12132@pasteur.Berkeley.EDU> Date: 19 Mar 91 02:56:37 GMT References: <10895@pasteur.Berkeley.EDU> <1991Mar3.053504.14027@mathcs.sjsu.edu> <281@nazgul.UUCP> <1991Mar14.042611.14921@mathcs.sjsu.edu> Sender: news@pasteur.Berkeley.EDU Reply-To: jbuck@galileo.berkeley.edu (Joe Buck) Lines: 30 In article <1991Mar14.042611.14921@mathcs.sjsu.edu>, horstman@mathcs.sjsu.edu (Cay Horstmann) writes: |> 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? How are you going to implement this? operator new is handed a size_t object and returns an object of type void. It doesn't know what type it's supposed to return. Or do you want to make the "default" operator new special (preventing a user from writing something similar)? Even if you could solve the technical problems, I'm still against it; it will just lead to lazy programming and subtle bugs (people will stop worrying about initializing every object member). Next you'll be asking for a guarantee that when I write void foo (int arg1) { char byteArray[BIGBUF]; int intArray[INTBUF]; ... } that byteArray and intArray be initialized to all zeros as well. If not, why not? Why should creating an array with new be different from making automatic variables? -- Joe Buck jbuck@galileo.berkeley.edu {uunet,ucbvax}!galileo.berkeley.edu!jbuck