Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!pp!pink!rfg From: rfg@pink.ACA.MCC.COM (Ron Guilmette) Newsgroups: comp.lang.c++ Subject: Re: operator new() scoping Keywords: storage management garbage collection new delete private Message-ID: <242@pink.ACA.MCC.COM> Date: 9 Jun 89 19:57:39 GMT References: <1989Jun7.115321.22620@mntgfx.mentor.com> Reply-To: rfg@pink.aca.mcc.com.UUCP (Ron Guilmette) Organization: MCC Austin, Texas Lines: 31 In article <1989Jun7.115321.22620@mntgfx.mentor.com> nmyers@mntgfx.mentor.com (Nathan Myers) writes: ^ >Providing arguments for operators new() and delete() is a major ^ >advance. It offers more power than "this=" semantics, and allows ^ >smaller, faster code. However, ... [ problems ] ... ^ >This seems inconsistent to me. Other overloaded functions don't ^ >hide their neighbors, why should operator new()? The standard way ^ >to hide a global is to declare a member with the same name and arguments. ^ >Then, if I (as class T author) want to disallow ::operator new(size_t), ^ >I can declare a private one and not define it. ^ > ^ >A self-consistent alternative to the posted semantics is: ^ >1. Member operator new(size_t, class Foo) doesn't hide global ::new(size_t). ^^^^^^^^^^^^^ Do you mean ::operator new(size_t) ? ^ >2. Member operator new(size_t) may be declared private. ^ >3. "::new T" is not valid syntax. (It seems unnecessary, and dangerous.) ^^^^^^^^ Did you mean ::operator new T ? -- // Ron Guilmette - MCC - Experimental Systems Kit Project // 3500 West Balcones Center Drive, Austin, TX 78759 - (512)338-3740 // ARPA: rfg@mcc.com // UUCP: {rutgers,uunet,gatech,ames,pyramid}!cs.utexas.edu!pp!rfg